pub struct SnapshotManager { /* private fields */ }Expand description
Write/read handle of the snapshot caches, obtained via Engine::snapshot.
Feed adapters (message channels) call upsert /
remove when data arrives; the scheduler reads the same
store at each task prepare. upsert auto-registers the target with
default options when it does not exist yet, so a feed never drops data on
an unregistered name — register explicitly first when a non-default
policy or scope keys are needed. remove acts on an existing target
only: a tombstone for a name the engine never registered is a wiring
error, not a silent no-op.
Implementations§
Source§impl SnapshotManager
impl SnapshotManager
Sourcepub fn register(&self, name: &str, options: SnapshotOptions) -> Result<()>
pub fn register(&self, name: &str, options: SnapshotOptions) -> Result<()>
Register a snapshot target with its options (replaces any existing
registration of the same name — its cache is reset). Returns an error
when the options are invalid (see SnapshotOptions::validate).
Sourcepub fn upsert(
&self,
name: &str,
scope: &str,
rev: u64,
data: Vars,
) -> Result<()>
pub fn upsert( &self, name: &str, scope: &str, rev: u64, data: Vars, ) -> Result<()>
Feed a new value for name/scope. Auto-registers the target with
SnapshotOptions::default when missing, so the write only fails
when those options are rejected (see SnapshotOptions::validate).
Revisions are monotonic per scope: a value whose rev is not newer
than the cached one is ignored (a stale revision cannot roll the
scope back).
Sourcepub fn remove(&self, name: &str, scope: &str) -> Result<()>
pub fn remove(&self, name: &str, scope: &str) -> Result<()>
Remove the value of name/scope (tombstone). Fails when the target
is not registered — there is nothing to tombstone, and a caller that
believes it deleted a target should hear about the mismatch.
Trait Implementations§
Source§impl Clone for SnapshotManager
impl Clone for SnapshotManager
Source§fn clone(&self) -> SnapshotManager
fn clone(&self) -> SnapshotManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more