pub trait Store<V>:
Send
+ Sync
+ 'static{
// Required methods
fn put_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
value: V,
options: PutOptions,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<V>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn list<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
prefix: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
// Provided methods
fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
value: V,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn list_namespaces<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_ctx: &'life1 ExecutionContext,
_prefix: &'life2 NamespacePrefix,
) -> Pin<Box<dyn Future<Output = Result<Vec<Namespace>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn evict_expired<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 ExecutionContext,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Persistent (or in-memory) key/value store, scoped by Namespace.
Every method takes ExecutionContext so remote backends can
honour caller-side cancellation and deadlines (invariant
“cancellation propagation”). In-memory impls accept the parameter
for trait uniformity and otherwise ignore it.
Required Methods§
Sourcefn put_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
value: V,
options: PutOptions,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn put_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
value: V,
options: PutOptions,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Insert or replace value at (ns, key) with the supplied
per-write options (TTL, future fields). This is the only
required write — Self::put is a thin convenience that
delegates here.
Sourcefn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<V>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<V>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Look up (ns, key). Returns None if absent or expired.
Sourcefn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Delete (ns, key). Idempotent — deleting an absent key
succeeds.
Sourcefn list<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
prefix: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn list<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
prefix: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
List keys under ns whose names start with prefix (or all
keys if prefix is None). Order is unspecified.
Provided Methods§
Sourcefn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
value: V,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ctx: &'life1 ExecutionContext,
ns: &'life2 Namespace,
key: &'life3 str,
value: V,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Insert or replace value at (ns, key) with default options
(no TTL). The default impl delegates to
Self::put_with_options — backends only need to provide one.
Sourcefn list_namespaces<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_ctx: &'life1 ExecutionContext,
_prefix: &'life2 NamespacePrefix,
) -> Pin<Box<dyn Future<Output = Result<Vec<Namespace>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list_namespaces<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_ctx: &'life1 ExecutionContext,
_prefix: &'life2 NamespacePrefix,
) -> Pin<Box<dyn Future<Output = Result<Vec<Namespace>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
List every Namespace under prefix that holds at least
one entry. The default impl returns an empty list — backends
override when they can enumerate cheaply (Postgres index
scan, Redis SCAN). Order is unspecified.
Useful for “list all conversations under agent-X” or admin tooling that audits per-tenant storage.
Sourcefn evict_expired<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 ExecutionContext,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn evict_expired<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 ExecutionContext,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sweep expired entries. Returns the number of rows removed.
Default impl returns Ok(0) — only backends that natively
track TTL implement this. Operators schedule it on a timer
(or trigger from cron / periodic graph) to bound store
growth in deployments where the store does not auto-expire
(e.g. plain put into Postgres without a TTL trigger).