pub trait SessionKvStore: Send + Sync {
// Required methods
fn get(&self, key: &[u16]) -> Result<Option<Vec<u16>>, SessionKvError>;
fn has(&self, key: &[u16]) -> Result<bool, SessionKvError>;
fn set(&self, key: &[u16], payload: &[u16]) -> Result<(), SessionKvError>;
fn remove(&self, key: &[u16]) -> Result<bool, SessionKvError>;
fn scan(
&self,
after: Option<&[u16]>,
prefix: &[u16],
max_scan: usize,
) -> Result<SessionKvPage, SessionKvError>;
fn limits(&self) -> SessionKvLimits;
}Expand description
Session-scoped key-value storage.
Every operation is atomic and commits only after validation and capacity reservation succeed, so a rejected write leaves the previous entry intact. Concurrent writes to one key resolve last-committed-write.
Required Methods§
Sourcefn get(&self, key: &[u16]) -> Result<Option<Vec<u16>>, SessionKvError>
fn get(&self, key: &[u16]) -> Result<Option<Vec<u16>>, SessionKvError>
Ok(None) is an absent key. A present entry holding a serialized
null returns Ok(Some(..)) — callers distinguish the two.
fn has(&self, key: &[u16]) -> Result<bool, SessionKvError>
fn set(&self, key: &[u16], payload: &[u16]) -> Result<(), SessionKvError>
Sourcefn remove(&self, key: &[u16]) -> Result<bool, SessionKvError>
fn remove(&self, key: &[u16]) -> Result<bool, SessionKvError>
Ok(true) when an entry existed and was removed.
Sourcefn scan(
&self,
after: Option<&[u16]>,
prefix: &[u16],
max_scan: usize,
) -> Result<SessionKvPage, SessionKvError>
fn scan( &self, after: Option<&[u16]>, prefix: &[u16], max_scan: usize, ) -> Result<SessionKvPage, SessionKvError>
Keys in UTF-16 code-unit order, strictly after after when given and
starting with prefix. Scans at most max_scan keys; matching is exact
code units, with no normalization or path semantics.
fn limits(&self) -> SessionKvLimits
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".