|
A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
|
The default in-memory ChunkStore: all reads and writes stay in local process memory. More...
#include <cpp/a11/stores/local_chunk_store.h>
Classes | |
| struct | State |
Public Member Functions | |
| ~LocalChunkStore () override=default | |
| a11::Future< data::NodeFragment > | Get (std::uint32_t seq, absl::Time deadline) override |
| Get the fragment stored at a sequence number. | |
| a11::Future< data::NodeFragment > | GetByArrivalOrder (std::uint64_t arrival_order, absl::Time deadline) override |
| Get the fragment identified by the order in which it arrived, rather than by its sequence number. | |
| a11::Future< std::vector< std::optional< data::NodeFragment > > > | Next (absl::Time deadline, size_t limit) override |
Get up to limit fragments from the shared logical-sequence cursor. | |
| a11::Future< std::uint32_t > | Put (data::NodeFragment fragment) override |
| Append a single fragment to the log. | |
| a11::Future< std::vector< std::uint32_t > > | PutMany (std::vector< data::NodeFragment > fragments) override |
| Append several fragments in one batch. | |
| a11::Future< data::NodeFragment > | ClearData (std::uint32_t seq) override |
| Erase the payload of the fragment at a sequence number while keeping its slot. | |
| a11::Future< std::uint32_t > | GetSeqForArrivalOrder (std::uint64_t arrival_order) override |
| Translate an arrival order into the sequence number of that fragment. | |
| a11::Future< std::optional< std::uint32_t > > | GetFinalSeq () override |
| Get the sequence number explicitly marked as the final fragment. | |
| a11::Future< absl::Status > | CloseWritesWithStatus (absl::Status status, bool return_status_if_already_closed) override |
| Seal the store against further writes with a terminal status. | |
| a11::Future< size_t > | Size () override |
| Get the number of fragments currently in the store. | |
| absl::StatusOr< std::string > | GetId () const override |
| Get the store's node identifier. | |
| LocalChunkStore (ConstructorToken, std::shared_ptr< State > state) | |
| Internal constructor; use Create() instead. | |
| a11::Future< absl::Status > | CloseWritesWithStatus (absl::Status status) |
| Seal the store against further writes with a terminal status. | |
| virtual a11::Future< absl::Status > | CloseWritesWithStatus (absl::Status status, bool return_status_if_already_closed)=0 |
| Seal the store against further writes with a terminal status. | |
| a11::Future< data::NodeFragment > | Get (std::uint32_t seq) |
| Get the fragment at a sequence number, waiting indefinitely. | |
| virtual a11::Future< data::NodeFragment > | Get (std::uint32_t seq, absl::Time deadline)=0 |
| Get the fragment stored at a sequence number. | |
| a11::Future< data::NodeFragment > | GetByArrivalOrder (std::uint64_t arrival_order) |
| Get a fragment by arrival order, waiting indefinitely. | |
| virtual a11::Future< data::NodeFragment > | GetByArrivalOrder (std::uint64_t arrival_order, absl::Time deadline)=0 |
| Get the fragment identified by the order in which it arrived, rather than by its sequence number. | |
| a11::Future< std::vector< std::optional< data::NodeFragment > > > | Next () |
| Get the next logical-sequence fragment, waiting indefinitely. | |
| a11::Future< std::vector< std::optional< data::NodeFragment > > > | Next (absl::Time deadline) |
| Get the next logical-sequence fragment before a deadline. | |
| virtual a11::Future< std::vector< std::optional< data::NodeFragment > > > | Next (absl::Time deadline, size_t limit)=0 |
Get up to limit fragments from the shared logical-sequence cursor. | |
Public Member Functions inherited from a11::stores::ChunkStore | |
| virtual | ~ChunkStore ()=default |
| a11::Future< data::NodeFragment > | Get (std::uint32_t seq) |
| Get the fragment at a sequence number, waiting indefinitely. | |
| a11::Future< data::NodeFragment > | GetByArrivalOrder (std::uint64_t arrival_order) |
| Get a fragment by arrival order, waiting indefinitely. | |
| a11::Future< std::vector< std::optional< data::NodeFragment > > > | Next () |
| Get the next logical-sequence fragment, waiting indefinitely. | |
| a11::Future< std::vector< std::optional< data::NodeFragment > > > | Next (absl::Time deadline) |
| Get the next logical-sequence fragment before a deadline. | |
| a11::Future< absl::Status > | CloseWritesWithStatus (absl::Status status) |
| Seal the store against further writes with a terminal status. | |
Static Public Member Functions | |
| static absl::StatusOr< std::shared_ptr< LocalChunkStore > > | Create (std::string node_id) |
Create an in-memory store identified by node_id. | |
The default in-memory ChunkStore: all reads and writes stay in local process memory.
This is the store an agent uses when it runs in a single process. It implements the full ChunkStore contract – reads and writes still return awaitables – so it composes with the same async reader and writer as remote stores. All fragment state and its synchronization are owned by an internal, reference-counted State; instances are created through Create() and held via shared_ptr.
|
overridedefault |
|
inlineexplicit |
|
overridevirtual |
Erase the payload of the fragment at a sequence number while keeping its slot.
Used to reclaim memory for fragments that have already been consumed without disturbing the sequence numbering.
| seq | The sequence number whose payload should be cleared. |
Implements a11::stores::ChunkStore.
|
inline |
Seal the store against further writes with a terminal status.
Convenience overload that does not return the previously recorded status if the store is already closed.
| status | The terminal status to record; readers awaiting Next() are released. |
|
overridevirtual |
Seal the store against further writes with a terminal status.
Once closed, readers blocked on Next() are released. Call this when a producer has finished (or failed).
| status | The terminal status to record. |
| return_status_if_already_closed | When true, a second close resolves with the status recorded by the first close instead of overwriting it. |
Implements a11::stores::ChunkStore.
|
virtual |
Seal the store against further writes with a terminal status.
Once closed, readers blocked on Next() are released. Call this when a producer has finished (or failed).
| status | The terminal status to record. |
| return_status_if_already_closed | When true, a second close resolves with the status recorded by the first close instead of overwriting it. |
Implements a11::stores::ChunkStore.
|
static |
Create an in-memory store identified by node_id.
| node_id | The identifier reported by GetId(). |
|
inline |
Get the fragment at a sequence number, waiting indefinitely.
Convenience overload equivalent to Get() with an infinite deadline.
| seq | The sequence number of the fragment to retrieve. |
|
overridevirtual |
Get the fragment stored at a sequence number.
As storage may be non-local, errors are surfaced through the resolved fragment/status. Correct implementations resolve with an error rather than blocking forever once the fragment can no longer arrive (e.g. writes were closed with a smaller final sequence number).
| seq | The sequence number of the fragment to retrieve. |
| deadline | The absolute time after which the wait gives up. |
Implements a11::stores::ChunkStore.
|
virtual |
Get the fragment stored at a sequence number.
As storage may be non-local, errors are surfaced through the resolved fragment/status. Correct implementations resolve with an error rather than blocking forever once the fragment can no longer arrive (e.g. writes were closed with a smaller final sequence number).
| seq | The sequence number of the fragment to retrieve. |
| deadline | The absolute time after which the wait gives up. |
Implements a11::stores::ChunkStore.
|
inline |
Get a fragment by arrival order, waiting indefinitely.
Convenience overload equivalent to GetByArrivalOrder() with an infinite deadline.
| arrival_order | The zero-based rank in which the fragment arrived in the store. |
|
overridevirtual |
Get the fragment identified by the order in which it arrived, rather than by its sequence number.
Useful for replaying fragments in ingestion order regardless of the sequence numbers assigned to them.
| arrival_order | The zero-based rank in which the fragment arrived in the store. |
| deadline | The absolute time after which the wait gives up. |
Implements a11::stores::ChunkStore.
|
virtual |
Get the fragment identified by the order in which it arrived, rather than by its sequence number.
Useful for replaying fragments in ingestion order regardless of the sequence numbers assigned to them.
| arrival_order | The zero-based rank in which the fragment arrived in the store. |
| deadline | The absolute time after which the wait gives up. |
Implements a11::stores::ChunkStore.
|
overridevirtual |
Get the sequence number explicitly marked as the final fragment.
Finality and write closure are separate state transitions. A producer may mark a fragment final before closing the store, and CloseWritesWithStatus() does not invent a final fragment.
Implements a11::stores::ChunkStore.
|
overridevirtual |
Get the store's node identifier.
Implements a11::stores::ChunkStore.
|
overridevirtual |
Translate an arrival order into the sequence number of that fragment.
| arrival_order | The zero-based rank in which the fragment arrived in the store. |
Implements a11::stores::ChunkStore.
|
inline |
Get the next logical-sequence fragment, waiting indefinitely.
Convenience overload equivalent to Next() with an infinite deadline and a limit of one.
|
inline |
Get the next logical-sequence fragment before a deadline.
Convenience overload equivalent to Next() with a limit of one.
| deadline | The absolute time after which the wait gives up. |
|
overridevirtual |
Get up to limit fragments from the shared logical-sequence cursor.
Next() advances through sequence numbers 0, 1, 2, and so on. It waits at a gap rather than switching to ingestion order; use GetByArrivalOrder() for that view. After the final sequence or a clean write closure, the result includes a nullopt end sentinel. Call repeatedly to follow the store as it grows.
| deadline | The absolute time after which the wait gives up. |
| limit | The maximum number of fragments to return in one call. |
limit data fragments; a clean end may append a nullopt sentinel. Implements a11::stores::ChunkStore.
|
virtual |
Get up to limit fragments from the shared logical-sequence cursor.
Next() advances through sequence numbers 0, 1, 2, and so on. It waits at a gap rather than switching to ingestion order; use GetByArrivalOrder() for that view. After the final sequence or a clean write closure, the result includes a nullopt end sentinel. Call repeatedly to follow the store as it grows.
| deadline | The absolute time after which the wait gives up. |
| limit | The maximum number of fragments to return in one call. |
limit data fragments; a clean end may append a nullopt sentinel. Implements a11::stores::ChunkStore.
|
overridevirtual |
Append a single fragment to the log.
| fragment | The fragment to append. |
Implements a11::stores::ChunkStore.
|
overridevirtual |
Append several fragments in one batch.
Preferred over repeated Put() calls when many fragments are emitted at once, to reduce round-trips.
| fragments | The fragments to append, in order. |
Implements a11::stores::ChunkStore.
|
overridevirtual |
Get the number of fragments currently in the store.
Implements a11::stores::ChunkStore.