pub struct NamespacedStore { /* private fields */ }Expand description
A DataStore view that prefixes every key with <namespace>/ before
delegating to an inner, shared store.
The inner store is held as Arc<dyn DataStore>, so the same underlying
storage can back several differently-namespaced views (and other,
un-namespaced holders) at once.
Implementations§
Trait Implementations§
Source§impl Clone for NamespacedStore
impl Clone for NamespacedStore
Source§fn clone(&self) -> NamespacedStore
fn clone(&self) -> NamespacedStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DataStore for NamespacedStore
impl DataStore for NamespacedStore
Source§fn snapshot(&self) -> State
fn snapshot(&self) -> State
Delegates to the inner store as-is — the snapshot carries the full, namespaced keys, not the device-relative ones.
NOTE: not yet prefix-filtered or stripped. A namespaced view’s snapshot
returns the entire shared store (every namespace), with full keys. This
is a later refinement; for now it is fine because the runtime only drains
subscribe to flush changes outward and the
device’s HAL/bridge are fakes.
Source§fn subscribe(&self) -> Subscription
fn subscribe(&self) -> Subscription
Delegates to the inner store as-is — the feed carries the full, namespaced keys, not the device-relative ones, and is not filtered to this namespace.
NOTE: not yet prefix-filtered or stripped (see snapshot).
A later refinement; fine for now because the runtime only drains this to
flush changes outward (already-namespaced keys are what the shared feed
wants) and the device’s HAL/bridge are fakes.
Source§fn read(&self, keys: &[Key]) -> Vec<Option<Value>>
fn read(&self, keys: &[Key]) -> Vec<Option<Value>>
None if the key is unset/absent.Source§fn write(&self, changes: StateChange) -> Result<(), DataError>
fn write(&self, changes: StateChange) -> Result<(), DataError>
StateChange.Source§fn slot(&self, key: &Key) -> Box<dyn Slot>
fn slot(&self, key: &Key) -> Box<dyn Slot>
Slot handle (read + write the same cell
without repeating the lookup).Source§fn clone_box(&self) -> Box<dyn DataStore>
fn clone_box(&self) -> Box<dyn DataStore>
&self everywhere), and this
puts that fact on the trait, so a holder of dyn DataStore can keep an
independent live handle — e.g. one kept aside before handing a store to
a device that takes it by value.