pub struct DataspaceRegistry { /* private fields */ }Expand description
A dataspace registry for async coordination between processes.
The registry stores broadcast channels indexed by type and Identifier. Processes can subscribe to receive
assertion and retraction updates for a given type and identifier filter, and other processes can assert or retract
values that are delivered to all matching subscribers.
§Thread Safety
DataspaceRegistry is Clone and can be safely shared across threads and tasks. All operations are thread-safe.
Implementations§
Source§impl DataspaceRegistry
impl DataspaceRegistry
Sourcepub fn try_current() -> Option<Self>
pub fn try_current() -> Option<Self>
Returns the dataspace registry for the current supervision tree, if one exists.
Sourcepub fn with_channel_capacity(capacity: usize) -> Self
pub fn with_channel_capacity(capacity: usize) -> Self
Creates a new empty registry with the given channel capacity for broadcast channels.
Sourcepub fn assert<T>(&self, value: T, id: impl Into<Identifier>)
pub fn assert<T>(&self, value: T, id: impl Into<Identifier>)
Asserts a value with the given identifier, notifying all matching subscribers.
The assertion is automatically associated with the current process, and will be automatically retracted when that process exists. Only the owning process may update an existing assertion for a given type/identifier combination.
Sourcepub fn retract<T>(&self, id: impl Into<Identifier>)
pub fn retract<T>(&self, id: impl Into<Identifier>)
Retracts the value of the given type and identifier, notifying all matching subscribers.
Only the process that originally asserted the value may retract it.
Sourcepub fn send<T>(&self, value: T, id: impl Into<Identifier>)
pub fn send<T>(&self, value: T, id: impl Into<Identifier>)
Sends a transient message with the given identifier to all matching subscribers.
Unlike assert, only the current matching subscribers are notified: messages are never stored
or replayed. If not matching subscribers exist, the message is dropped.
Sourcepub fn current_values<T>(&self, filter: IdentifierFilter) -> Vec<T>
pub fn current_values<T>(&self, filter: IdentifierFilter) -> Vec<T>
This is a synchronous point-in-time read that locks the registry, collects matching values, and returns immediately without creating any subscription or channel. Use this when you need a snapshot of what is currently asserted rather than ongoing notifications of future changes.
Sourcepub fn subscribe<T>(&self, filter: IdentifierFilter) -> Subscription<T>
pub fn subscribe<T>(&self, filter: IdentifierFilter) -> Subscription<T>
Subscribes to updates matching the given filter.
Returns a Subscription that can be used to asynchronously receive updates. Any updates to assertions that
match the filter at the time of subscribing will be immediately replayed into the subscription’s pending queue.
Messages are never replayed, so only those sent after subscribing are delivered.
Trait Implementations§
Source§impl Clone for DataspaceRegistry
impl Clone for DataspaceRegistry
Source§fn clone(&self) -> DataspaceRegistry
fn clone(&self) -> DataspaceRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DataspaceRegistry
impl RefUnwindSafe for DataspaceRegistry
impl Send for DataspaceRegistry
impl Sync for DataspaceRegistry
impl Unpin for DataspaceRegistry
impl UnwindSafe for DataspaceRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more