|
A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
|
An a11::nodes::AsyncNode is an ordered sequence backed by a a11::stores::ChunkStore. Action ports use nodes, but a native application can also create one directly for model tokens, audio frames, progress records, or other incremental data.
The default local store keeps fragments in memory. A serialization registry is optional; AsyncNode::Create uses the process-wide registry when none is supplied.
Put() serializes one value and returns its assigned sequence number after the store accepts it. Awaiting that result propagates storage errors and applies backpressure to a producer.
The no-value Finalize() writes an invisible final marker. It is useful when a producer learns that the preceding value was last only after writing it. Finalize(value) records that value itself as final and avoids the extra marker.
NextObject<T>() returns the next decoded value or std::nullopt at a clean end. Each call advances this node's reader.
Use ResetReader() before replaying a node. Durable Redis and SQLite stores retain finality as data, so a later reader observes the same end after a restart.
Use chunks when bytes already have their final representation. The chunk's metadata is the only source of truth for decoding those bytes.
A reader that needs the representation calls NextChunk() and checks its size before allocating or decoding application objects:
Close() only closes storage. It does not identify a final value. Use it for a source such as a log that can promise no more records but cannot define a single final sequence. Use AbortWithStatus() when partial output represents a failure; readers then receive the status instead of a successful end.
Node writes enter a bounded writer before reaching the store. A fast producer can use WaitForBufferToDrain() at a natural batching boundary:
The confirmation from Put() means the local store accepted the fragment. It does not acknowledge that a remote reader processed it. End-to-end acknowledgements belong in an application output port.