StormByte-Buffer 4.0.0
C++26 buffer module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Buffer Namespace Reference

Buffer module of the StormByte suite. More...

Namespaces

namespace  Detail
 Private queue implementation contracts.
namespace  IO
 Buffered binary sources and sinks.
namespace  Backend
 PIMPL coordinators for public Buffer types that are not IO.

Classes

class  Bridge
 Manual bridge between two StormByte-Buffer ends. More...
struct  AdmissionWaitObserver
 Borrowed, allocation-free observer for one synchronous PushFor call. More...
class  QueueLimits
 Independent local bounds; absent means unlimited, engaged zero means zero capacity. More...
struct  QueueSnapshot
 Coherent queue accounting; bytes are caller-supplied weights, never RSS. More...
struct  BudgetSnapshot
 Shared reservation counters, independent of any particular queue. More...
class  ByteBudget
 Shared logical byte accounting for queues and concurrent work. More...
class  Consumer
 Read-oriented handle over a shared Ring. More...
class  Exception
 Root exception for Buffer. More...
class  Error
 General exception for buffer errors. More...
class  ReadError
 Read, extract or peek failed. More...
class  WriteError
 Write failed. More...
class  FIFO
 Byte-oriented FIFO buffer with grow-on-demand and close/error support. More...
class  Generic
 Abstract root of the byte-buffer interfaces. More...
class  ReadOnly
 Buffer that can be read and not written. More...
class  WriteOnly
 Buffer that can be written and not read. More...
class  ReadWrite
 Read and write interface. More...
class  Sink
 Forward declaration of the keyed typed queue. More...
class  Hopper
 Synchronized typed item queue with shared-writer support. More...
class  PipeInput
 Synchronous, non-owning stage input borrow. More...
class  PipeOutput
 Synchronous, non-owning stage output borrow with const mutation forwarding. More...
class  Pipe
 One transformation in a Pipeline. More...
class  Pipeline
 Multi-pipe byte transformation over stream buffers. More...
class  Producer
 Write-only handle over a shared Ring. More...
class  Chunk
 Pumper cycle size. More...
class  HighWater
 Input occupancy cap for Pumper. More...
class  Pumper
 Owns a Bridge and moves bytes until EoF, failure or Cancel. More...
class  Ring
 Highly concurrent thread-safe ring buffer. More...
class  SharedFIFO
 Thread-safe FIFO built on top of FIFO. More...
class  Telemetry
 Buffer session counters layered on Base's independent clock samples. More...
class  ReadTelemetry
 Basic read counters. More...
class  WriteTelemetry
 Basic write counters. More...

Enumerations

enum class  QueueStatus {
  Ok , WouldBlock , TooLarge , Closed ,
  Cancelled , Timeout , Missing , Empty ,
  Error , Invalid
}
 Admission outcomes. More...
enum class  AdmissionWaitReason { LocalCapacity , SharedBudget }
 Cause of a weighted admission wait, selected while admission is locked. More...
enum class  Position { Absolute , Relative }
 Forward declaration of the WriteOnly interface. More...
enum class  ExecutionMode : unsigned { Sync = 0 , Async = 1u << 0 , Parallel = 1u << 1 }
 Bitmask controlling how Pipeline::Process schedules work. More...

Functions

constexpr ExecutionMode operator| (ExecutionMode a, ExecutionMode b) noexcept
 Bitwise OR of execution flags.
constexpr ExecutionMode operator& (ExecutionMode a, ExecutionMode b) noexcept
 Bitwise AND of execution flags.
constexpr ExecutionMode & operator|= (ExecutionMode &a, ExecutionMode b) noexcept
 Bitwise OR-assignment of execution flags.
constexpr bool HasExecutionFlag (ExecutionMode mode, ExecutionMode flag) noexcept
 Whether mode includes all bits of flag.

Detailed Description

Buffer module of the StormByte suite.

Generic buffering and accounting mechanisms.

Enumeration Type Documentation

◆ AdmissionWaitReason

Cause of a weighted admission wait, selected while admission is locked.

Enumerator
LocalCapacity 

Local element or byte bounds deny admission before reservation.

SharedBudget 

Local bounds allow admission but TryReserve reports WouldBlock.

◆ ExecutionMode

enum class StormByte::Buffer::ExecutionMode : unsigned
strong

Bitmask controlling how Pipeline::Process schedules work.

Flags are orthogonal and may be combined with operator|.

  • Sync (0) — no flags: stages run sequentially on the caller’s thread; Pipeline::Process blocks until completion.
  • Async — run work on background thread(s); Pipeline::Process returns immediately with the final Consumer.
  • Parallel — one thread per stage (pipeline parallelism via SPSC intermediate rings). Without Async, Pipeline::Process still waits for all stages to finish before returning.

Typical combinations:

Expression Stages Process()
Sync (or 0) sequential, caller blocks
Async sequential, 1 worker returns now
Parallel 1 thread per stage blocks
Async | Parallel 1 thread per stage returns now
Note
Prefer Async | Parallel for multi-stage streaming production. Use Sync for deterministic debugging.
See also
Pipeline::Process(), HasExecutionFlag()
Enumerator
Sync 

Sequential on caller thread; Process blocks.

Async 

Background execution; Process returns immediately.

Parallel 

One thread per stage (pipeline parallelism).

◆ Position

enum class StormByte::Buffer::Position
strong

Forward declaration of the WriteOnly interface.

Positioning mode for buffer seek / non-destructive read operations.

Defines how offset values are interpreted by Seek() and related APIs.

See also
ReadOnly::Seek()
Enumerator
Absolute 

Offset from the beginning of the buffer (position 0).

Relative 

Offset from the current logical read position.

◆ QueueStatus

enum class StormByte::Buffer::QueueStatus
strong

Admission outcomes.

Failure preserves the caller's item and output lease.

Enumerator
Ok 

Accepted.

WouldBlock 

Capacity unavailable.

TooLarge 

The item can never fit the configured limit.

Closed 

Queue, Sink or budget closed.

Cancelled 

Pending admissions cancelled.

Timeout 

Bounded wait expired.

Missing 

Sink key does not exist.

Empty 

Nullable item was empty.

Error 

Storage allocation failed.

Invalid 

Invalid duration, lease or configuration.

Function Documentation

◆ HasExecutionFlag()

bool StormByte::Buffer::HasExecutionFlag ( ExecutionMode mode,
ExecutionMode flag )
inlineconstexprnoexcept

Whether mode includes all bits of flag.

Parameters
modeCombined mode value.
flagFlag (or flag set) to test.
Returns
true if every bit in flag is set in mode.

◆ operator&()

ExecutionMode StormByte::Buffer::operator& ( ExecutionMode a,
ExecutionMode b )
inlineconstexprnoexcept

Bitwise AND of execution flags.

Parameters
aLeft-hand flags.
bRight-hand flags.
Returns
Intersection of flag sets.

◆ operator|()

ExecutionMode StormByte::Buffer::operator| ( ExecutionMode a,
ExecutionMode b )
inlineconstexprnoexcept

Bitwise OR of execution flags.

Parameters
aLeft-hand flags.
bRight-hand flags.
Returns
Combined flag set.

◆ operator|=()

ExecutionMode & StormByte::Buffer::operator|= ( ExecutionMode & a,
ExecutionMode b )
inlineconstexprnoexcept

Bitwise OR-assignment of execution flags.

Parameters
aFlags to update.
bFlags to add.
Returns
Reference to a.