pub struct KeyspaceHandle {
pub name: String,
/* private fields */
}Fields§
§name: StringImplementations§
Source§impl KeyspaceHandle
impl KeyspaceHandle
pub async fn insert<V>(
&self,
key: impl Into<Vec<u8>>,
value: &V,
) -> Result<(), AppError>where
V: Serialize,
pub async fn get<V>(
&self,
key: impl Into<Vec<u8>>,
) -> Result<Option<V>, AppError>where
V: DeserializeOwned + Send + 'static,
Sourcepub async fn take<V>(
&self,
key: impl Into<Vec<u8>>,
) -> Result<Option<V>, AppError>where
V: DeserializeOwned + Send + 'static,
pub async fn take<V>(
&self,
key: impl Into<Vec<u8>>,
) -> Result<Option<V>, AppError>where
V: DeserializeOwned + Send + 'static,
Atomically get-and-remove a key, returning the deserialized value.
Backed by KeyspaceOps::take_raw_atomic — exactly one concurrent
caller observes Some for a given key. Suitable for refresh-token
rotation, single-use enrolment tokens, and any other “consume
exactly once” pattern across multiple webvh replicas.
Sourcepub async fn take_raw(
&self,
key: impl Into<Vec<u8>>,
) -> Result<Option<Vec<u8>>, AppError>
pub async fn take_raw( &self, key: impl Into<Vec<u8>>, ) -> Result<Option<Vec<u8>>, AppError>
Atomically get-and-remove a key’s raw bytes.
See Self::take for the deserialised version. Use this when the
stored value is not JSON (e.g. a raw session_id under a refresh-
token index).
pub async fn remove(&self, key: impl Into<Vec<u8>>) -> Result<(), AppError>
pub async fn insert_raw( &self, key: impl Into<Vec<u8>>, value: impl Into<Vec<u8>>, ) -> Result<(), AppError>
pub async fn get_raw( &self, key: impl Into<Vec<u8>>, ) -> Result<Option<Vec<u8>>, AppError>
pub async fn contains_key( &self, key: impl Into<Vec<u8>>, ) -> Result<bool, AppError>
Sourcepub async fn iter_all(&self) -> Result<Vec<(Vec<u8>, Vec<u8>)>, AppError>
pub async fn iter_all(&self) -> Result<Vec<(Vec<u8>, Vec<u8>)>, AppError>
Iterate all key-value pairs in the keyspace.
Sourcepub async fn prefix_iter_raw(
&self,
prefix: impl Into<Vec<u8>>,
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, AppError>
pub async fn prefix_iter_raw( &self, prefix: impl Into<Vec<u8>>, ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, AppError>
Iterate all key-value pairs whose key starts with prefix.
Sourcepub async fn approximate_len(&self) -> Result<usize, AppError>
pub async fn approximate_len(&self) -> Result<usize, AppError>
Returns the approximate number of items in the keyspace.
Sourcepub async fn verify_integrity(&self) -> Result<u64, AppError>
pub async fn verify_integrity(&self) -> Result<u64, AppError>
Verify integrity of all entries in this keyspace.
Scans all key-value pairs and attempts to parse each value as JSON. Returns the number of corrupted (unparseable) entries found. Corrupted entries are logged as warnings.
Trait Implementations§
Source§impl Clone for KeyspaceHandle
impl Clone for KeyspaceHandle
Source§fn clone(&self) -> KeyspaceHandle
fn clone(&self) -> KeyspaceHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more