45#include <StormByte/safe/atomic.hxx>
46#include <StormByte/safe/condition_variable.hxx>
47#include <StormByte/safe/owner.hxx>
48#include <StormByte/safe/pointers.hxx>
49#include <StormByte/size.hxx>
50#include <StormByte/type_traits.hxx>
51#include <StormByte/type_traits/safe.hxx>
85 std::is_nothrow_default_constructible_v<T> && std::is_nothrow_move_constructible_v<T> &&
86 std::is_nothrow_move_assignable_v<T> && std::is_nothrow_destructible_v<T> &&
87 (
alignof(T) <= __STDCPP_DEFAULT_NEW_ALIGNMENT__);
93 template<HopperValue T>
132 template<Detail::HopperValue T>
165 template<Detail::HopperValue T>
367 T
Front() const noexcept requires
Type::CopyConstructible<T> &&
std::is_nothrow_copy_constructible_v<T>;
380 bool EoF() const noexcept;
453 hopper << std::move(item);
464 hopper << std::move(item);
472 friend class Sink<T>;
477 void AddWriter() noexcept;
482 void CloseWriter() noexcept;
487 void WakePending() noexcept;
500 std::chrono::milliseconds timeout, const
Safe::Atomic<
bool>* closed,
515 void Unnotify(
const void* owner)
noexcept;
521 class Implementation;
526 Implementation* m_io;
552 template<Buffer::Detail::HopperValue T>
Shared charge that can explicitly follow one payload across queues or work.
Definition byte_budget.hxx:261
Shared logical byte accounting for queues and concurrent work.
Definition byte_budget.hxx:256
T Front() const noexcept
Copy of the next item without dequeuing.
void CancelPending() noexcept
Cancel admissions already waiting; future calls remain permitted.
StormByte::Size Capacity() const noexcept
Gets the current capacity ceiling.
QueueStatus PushFor(T &item, StormByte::ByteSize bytes, std::chrono::milliseconds timeout, AdmissionWaitObserver observer={}) noexcept
Admit with a bounded wait; zero attempts immediately.
bool Empty() const noexcept
Checks whether the queue has no pending items.
bool Ready() const noexcept
Whether Pop can return an item or production is finished.
void Eof() noexcept
Marks end of production and wakes waiters.
T Pop() noexcept
Pops one item from the bucket, or returns default-constructed T if dry.
Hopper() noexcept(false)
Constructs an empty unbounded Hopper.
QueueSnapshot Snapshot() const noexcept
Coherent counters under a short lock, without capacity waits or I/O.
unsigned Writers() const noexcept
Live writers attached to this hopper.
QueueStatus TryPush(T &item, StormByte::ByteSize bytes) noexcept
Attempt a weighted admission without waiting for capacity.
void Limits(QueueLimits limits) noexcept
Set independent local limits without discarding existing entries.
StormByte::Size Size() const noexcept
Gets the number of items currently waiting in the bucket.
QueueStatus PushFor(T &item, const ByteBudget::Lease &lease, std::chrono::milliseconds timeout, AdmissionWaitObserver observer={}) noexcept
Admit with a shared charge and bounded wait.
QueueStatus Configure(QueueLimits limits, const ByteBudget &budget) noexcept
Attach aggregate accounting and local bounds to an empty hopper.
void Unnotify() noexcept
Drops both borrowed pointers set by Notify.
void Notify(Safe::ConditionVariable &wake) noexcept
Registers the consumer condition variable to notify on Push or Eof.
void Abort() noexcept
Close and discard entries, releasing charges outside the queue lock.
bool EoF() const noexcept
Checks whether Eof was called by a producer.
friend Hopper & operator>>(T &&item, Hopper &hopper) noexcept
Write: rvalue item flows into hopper.
Definition hopper.hxx:463
bool Full() const noexcept
Check whether an active local bound has been reached.
void Push(T item) noexcept
Enqueues one item and signals the consumer if Notify was configured.
Independent local bounds; absent means unlimited, engaged zero means zero capacity.
Definition byte_budget.hxx:125
Forward declaration of the keyed typed queue.
Definition sink.hxx:97
Values supported by the nonthrowing, Base-allocated typed queues.
Definition hopper.hxx:82
Private queue implementation contracts.
Buffer module of the StormByte suite.
QueueStatus
Admission outcomes.
Definition byte_budget.hxx:80
Named concepts and small type utilities used across the suite.
Root namespace of the StormByte C++ suite.
Borrowed, allocation-free observer for one synchronous PushFor call.
Definition byte_budget.hxx:117
HopperEntry() noexcept=default
Construct an empty entry before moving the caller's payload.
ByteBudget::Lease Charge
Shared aggregate charge.
Definition hopper.hxx:124
StormByte::ByteSize Bytes
Caller-defined logical weight.
Definition hopper.hxx:123
T Item
Caller payload.
Definition hopper.hxx:122
Coherent queue accounting; bytes are caller-supplied weights, never RSS.
Definition byte_budget.hxx:222