pub trait StateStore: Send + Sync {
// Required methods
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<CheckReport, FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn supports_list(&self) -> bool { ... }
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
_prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn supports_atomic_batch(&self) -> bool { ... }
fn put_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 [(String, Value)],
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Persistent key/value store for replication bookmarks and pipeline checkpoints.
Implementations must be safe to call from multiple tasks at once. The trait is intentionally minimal — three operations cover every bookmark flow the pipeline orchestrator needs.
Required Methods§
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the value stored under key, or None if no entry exists.
Sourcefn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store value under key, replacing any previous entry.
Implementations should make the update durable before returning so a
crash immediately after put does not lose the bookmark.
Provided Methods§
Sourcefn check<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<CheckReport, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<CheckReport, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run a fast, non-mutating preflight probe (used by faucet doctor).
The default returns
CheckReport::not_implemented.
Built-in stores override this with a reachability + sentinel
get/put/delete probe that leaves no residue.
Sourcefn supports_list(&self) -> bool
fn supports_list(&self) -> bool
Whether list can enumerate keys. Every built-in store
can; the default is false so a third-party store keeps compiling.
Sourcefn list<'life0, 'life1, 'async_trait>(
&'life0 self,
_prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
_prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Every stored key that starts with prefix, sorted ascending.
Used to enumerate a pipeline’s namespace ({name}::…) for
faucet state show|export. The default returns a typed error.
Sourcefn supports_atomic_batch(&self) -> bool
fn supports_atomic_batch(&self) -> bool
Whether put_batch commits all-or-nothing.
Sourcefn put_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 [(String, Value)],
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
entries: &'life1 [(String, Value)],
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store every entry. When supports_atomic_batch
is true either all entries land or none do; the default writes them
one by one, so an error can leave a prefix of entries written.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".