Skip to main content

chronon::sender::DirectSPSCQueueAdapter

More...

#include <MessageQueue.hpp>

Inherits from chronon::sender::IMessageQueue< T >

Public Functions

Name
virtual std::optional< T >tryPop(uint64_t current_cycle) override
booltracksAdmission() const
virtual size_tstorageCapacity() const override
virtual size_tsize() const override
virtual voidsetCapacity(size_t capacity) override
boolpushDirect(T && data, uint64_t arrive_cycle, uint32_t sender_id =0)
virtual boolpush(T data, uint64_t arrive_cycle) override
virtual voidpopAllInto(std::vector< T > & out, uint64_t current_cycle) override
Reusable-buffer drain: avoids the fresh-vector allocation popAll() makes per call.
virtual std::vector< T >popAll(uint64_t current_cycle) override
T *peekReady(uint64_t current_cycle)
std::optional< std::pair< uint64_t, uint32_t > >peekHead() const
virtual std::optional< uint64_t >minArrivalCycle() const override
virtual boolhasReady(uint64_t current_cycle) const override
virtual boolfull() const override
voidenableAdmissionTracking()
virtual boolempty() const override
template <typename Visitor >
bool
consumeReady(uint64_t current_cycle, Visitor && visitor)
voidconsumePeeked(uint64_t current_cycle)
virtual voidclear() override
virtual size_tcapacity() const override
virtual size_tavailable() const override
virtual size_tadmissionOccupancy(uint64_t send_cycle) const override
virtual std::optional< uint64_t >admissionMinArrivalCycle(uint64_t send_cycle) const override
DirectSPSCQueueAdapter(size_t capacity =LockFreeMessageQueue< T >::USABLE_CAPACITY, size_t min_usable_capacity =0, bool track_admission =true)

Additional inherited members

Public Functions inherited from chronon::sender::IMessageQueue< T >

Name
virtual~IMessageQueue() =default

Detailed Description

template <typename T >
class chronon::sender::DirectSPSCQueueAdapter;

DirectSPSCQueueAdapter - registered-edge SPSC backend.

Unlike LockFreeQueueAdapter, the physical queue and the admission ledger share one monotonic producer ticket. A successful release-store of tail_ticket_ therefore both publishes the payload and accounts for the architectural push, avoiding the second locked RMW in the legacy adapter. InPort may also push and consume the stored envelope directly, avoiding the extra by-value virtual-interface hops on the common one-message path.

The consumer still publishes each pop in three ordered stages required by same-cycle registered-edge admission:

  1. arrival metadata, 2. reusable queue head, 3. admission credit. A pop at cycle C is consequently not admission credit until cycle C + 1.

Public Functions Documentation

function tryPop

inline virtual std::optional< T > tryPop(
uint64_t current_cycle
) override

Reimplements: chronon::sender::IMessageQueue::tryPop

function tracksAdmission

inline bool tracksAdmission() const

function storageCapacity

inline virtual size_t storageCapacity() const override

Reimplements: chronon::sender::IMessageQueue::storageCapacity

function size

inline virtual size_t size() const override

Reimplements: chronon::sender::IMessageQueue::size

function setCapacity

inline virtual void setCapacity(
size_t capacity
) override

Reimplements: chronon::sender::IMessageQueue::setCapacity

function pushDirect

inline bool pushDirect(
T && data,
uint64_t arrive_cycle,
uint32_t sender_id =0
)

Producer-only direct path used by InPort after backend selection.

function push

inline virtual bool push(
T data,
uint64_t arrive_cycle
) override

Reimplements: chronon::sender::IMessageQueue::push

function popAllInto

inline virtual void popAllInto(
std::vector< T > & out,
uint64_t current_cycle
) override

Reusable-buffer drain: avoids the fresh-vector allocation popAll() makes per call.

Reimplements: chronon::sender::IMessageQueue::popAllInto

function popAll

inline virtual std::vector< T > popAll(
uint64_t current_cycle
) override

Reimplements: chronon::sender::IMessageQueue::popAll

function peekReady

inline T * peekReady(
uint64_t current_cycle
)

Consumer-only ready-entry view. The returned pointer remains owned by the consumer until consumePeeked() publishes the new head. This split lets typed InPort paths decide cancellation before constructing a large optional return object.

function peekHead

inline std::optional< std::pair< uint64_t, uint32_t > > peekHead() const

function minArrivalCycle

inline virtual std::optional< uint64_t > minArrivalCycle() const override

Reimplements: chronon::sender::IMessageQueue::minArrivalCycle

function hasReady

inline virtual bool hasReady(
uint64_t current_cycle
) const override

Reimplements: chronon::sender::IMessageQueue::hasReady

function full

inline virtual bool full() const override

Reimplements: chronon::sender::IMessageQueue::full

function enableAdmissionTracking

inline void enableAdmissionTracking()

Initialization-only: enable simulated-cycle admission credit tracking.

function empty

inline virtual bool empty() const override

Reimplements: chronon::sender::IMessageQueue::empty

function consumeReady

template <typename Visitor >
inline bool consumeReady(
uint64_t current_cycle,
Visitor && visitor
)

Consumer-only direct path. The visitor runs while the slot is owned by the consumer and may move from or discard the payload. Returning true means one ready entry was consumed, even if the visitor discarded it.

function consumePeeked

inline void consumePeeked(
uint64_t current_cycle
)

Publish consumption of the ready entry returned by peekReady().

function clear

inline virtual void clear() override

Reimplements: chronon::sender::IMessageQueue::clear

function capacity

inline virtual size_t capacity() const override

Reimplements: chronon::sender::IMessageQueue::capacity

function available

inline virtual size_t available() const override

Reimplements: chronon::sender::IMessageQueue::available

function admissionOccupancy

inline virtual size_t admissionOccupancy(
uint64_t send_cycle
) const override

Reimplements: chronon::sender::IMessageQueue::admissionOccupancy

function admissionMinArrivalCycle

inline virtual std::optional< uint64_t > admissionMinArrivalCycle(
uint64_t send_cycle
) const override

Reimplements: chronon::sender::IMessageQueue::admissionMinArrivalCycle

function DirectSPSCQueueAdapter

inline explicit DirectSPSCQueueAdapter(
size_t capacity =LockFreeMessageQueue< T >::USABLE_CAPACITY,
size_t min_usable_capacity =0,
bool track_admission =true
)

Updated on 2026-07-17 at 17:43:31 +0000