|
A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
|
A thread-safe registry of AsyncNodes keyed by id. More...
#include <cpp/a11/nodes/node_map.h>
Public Member Functions | |
| ~NodeMap ()=default | |
| absl::StatusOr< std::shared_ptr< AsyncNode > > | Get (std::string node_id) |
| Return the node for an id, creating it if it does not exist. | |
| absl::StatusOr< std::shared_ptr< AsyncNode > > | GetIfExists (std::string_view node_id) const |
| Return the node for an id without creating it. | |
| absl::Status | RegisterStorage (std::string storage_id, std::shared_ptr< NodeMap > storage) |
| Configure a host-accessible namespace and its backend node map. | |
| const std::optional< data::StorageIdentity > & | Storage () const |
| Identity of this map's backend, or absent for session-local storage. | |
| absl::Status | SetStorageResolver (StorageResolver resolver, std::vector< std::string > accessible_ids={}) |
| Adopt host connection policy; advertised ids must be directly accessible. | |
| std::vector< std::string > | StorageIds () const |
| Storage identities directly accessible through this host's resolver. | |
| void | SetAllowLazyReadResolution (bool allowed) |
| Permit read resolution to open uncached nodes through this map's factory. | |
| bool | AllowsLazyReadResolution () const |
| absl::StatusOr< std::shared_ptr< AsyncNode > > | Resolve (const data::NodeRef &reference) |
| Resolve a whole-node reference; windows require a fragment-window reader. | |
| absl::StatusOr< std::shared_ptr< AsyncNode > > | ResolveForRead (const data::NodeRef &reference) |
| Resolve an existing local target for a value read. | |
| absl::StatusOr< std::shared_ptr< AsyncNode > > | ImportReference (const data::NodeRef &reference, const std::shared_ptr< NodeMap > &source) |
| Share a referenced node from another scope, preserving its identity. | |
| absl::StatusOr< std::shared_ptr< AsyncNode > > | Discard (std::string_view node_id, const std::shared_ptr< AsyncNode > &expected=nullptr) |
| Remove the node for an id. | |
| bool | Contains (std::string_view node_id) const |
| Report whether a node with the given id exists. | |
| size_t | Size () const |
| Return the number of nodes currently in the map. | |
| std::vector< std::string > | Ids () const |
| Return the id of every node the map holds, sorted. | |
Static Public Member Functions | |
| static absl::StatusOr< std::shared_ptr< NodeMap > > | Create (ChunkStoreFactory factory={}, std::optional< data::StorageIdentity > storage={}) |
| Create a node map. | |
A thread-safe registry of AsyncNodes keyed by id.
Nodes are created lazily on first access via the map's ChunkStoreFactory. Instances are heap-allocated and shared via Create.
|
default |
| bool a11::nodes::NodeMap::AllowsLazyReadResolution | ( | ) | const |
| bool a11::nodes::NodeMap::Contains | ( | std::string_view | node_id | ) | const |
Report whether a node with the given id exists.
| node_id | The node identifier. |
|
static |
Create a node map.
| factory | Factory invoked to build the backing store for each new node; a default store is used when omitted. |
| absl::StatusOr< std::shared_ptr< AsyncNode > > a11::nodes::NodeMap::Discard | ( | std::string_view | node_id, |
| const std::shared_ptr< AsyncNode > & | expected = nullptr |
||
| ) |
Remove the node for an id.
| node_id | The node identifier. |
| expected | If non-null, only remove when the stored node matches this one (compare-and-remove). |
| absl::StatusOr< std::shared_ptr< AsyncNode > > a11::nodes::NodeMap::Get | ( | std::string | node_id | ) |
Return the node for an id, creating it if it does not exist.
| node_id | The node identifier. |
Return the node for an id, creating it if it does not exist.
| node_id | The node identifier. |
| absl::StatusOr< std::shared_ptr< AsyncNode > > a11::nodes::NodeMap::GetIfExists | ( | std::string_view | node_id | ) | const |
Return the node for an id without creating it.
| node_id | The node identifier. |
| std::vector< std::string > a11::nodes::NodeMap::Ids | ( | ) | const |
Return the id of every node the map holds, sorted.
A snapshot: nodes are created on demand, so the answer is what was there when it was asked for. Sorted rather than in hash order so a caller comparing two snapshots – a test, a diagnostic dump – sees a stable list.
| absl::StatusOr< std::shared_ptr< AsyncNode > > a11::nodes::NodeMap::ImportReference | ( | const data::NodeRef & | reference, |
| const std::shared_ptr< NodeMap > & | source | ||
| ) |
Share a referenced node from another scope, preserving its identity.
| absl::Status a11::nodes::NodeMap::RegisterStorage | ( | std::string | storage_id, |
| std::shared_ptr< NodeMap > | storage | ||
| ) |
Configure a host-accessible namespace and its backend node map.
| absl::StatusOr< std::shared_ptr< AsyncNode > > a11::nodes::NodeMap::Resolve | ( | const data::NodeRef & | reference | ) |
Resolve a whole-node reference; windows require a fragment-window reader.
| absl::StatusOr< std::shared_ptr< AsyncNode > > a11::nodes::NodeMap::ResolveForRead | ( | const data::NodeRef & | reference | ) |
Resolve an existing local target for a value read.
| void a11::nodes::NodeMap::SetAllowLazyReadResolution | ( | bool | allowed | ) |
Permit read resolution to open uncached nodes through this map's factory.
| absl::Status a11::nodes::NodeMap::SetStorageResolver | ( | StorageResolver | resolver, |
| std::vector< std::string > | accessible_ids = {} |
||
| ) |
Adopt host connection policy; advertised ids must be directly accessible.
| size_t a11::nodes::NodeMap::Size | ( | ) | const |
Return the number of nodes currently in the map.
|
inline |
Identity of this map's backend, or absent for session-local storage.
| std::vector< std::string > a11::nodes::NodeMap::StorageIds | ( | ) | const |
Storage identities directly accessible through this host's resolver.