pub struct LocalKeyspaceHandle { /* private fields */ }Implementations§
Source§impl LocalKeyspaceHandle
impl LocalKeyspaceHandle
pub fn is_encrypted(&self) -> bool
Sourcepub async fn persist(&self) -> Result<(), AppError>
pub async fn persist(&self) -> Result<(), AppError>
Fsync the owning database’s journal — see
KeyspaceHandle::persist.
pub async fn insert<V: Serialize>( &self, key: impl Into<Vec<u8>>, value: &V, ) -> Result<(), AppError>
pub async fn get<V: DeserializeOwned + Send + 'static>( &self, key: impl Into<Vec<u8>>, ) -> Result<Option<V>, AppError>
pub async fn remove(&self, key: impl Into<Vec<u8>>) -> Result<(), AppError>
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 + DELETE (the classic Redis GETDEL).
The get and remove run under the per-keyspace write lock
(see [WriteLocks]) so they are atomic with respect to any
other take_raw/swap/insert_if_absent racing on the same
keyspace — exactly one caller observes Some. (fjall alone
does NOT provide this: it serialises individual operations,
not check-then-write sequences across blocking threads.)
Used by the canonical refresh-token claim
(crate::auth::session::take_session_id_by_refresh) to
close the rotation TOCTOU: a leaked refresh token can be
presented exactly once even under concurrent retries.
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 prefix_iter_raw( &self, prefix: impl Into<Vec<u8>>, ) -> Result<Vec<RawKvPair>, AppError>
Sourcepub async fn range_from_raw(
&self,
from: impl Into<Vec<u8>>,
) -> Result<Vec<RawKvPair>, AppError>
pub async fn range_from_raw( &self, from: impl Into<Vec<u8>>, ) -> Result<Vec<RawKvPair>, AppError>
See KeyspaceHandle::range_from_raw. fjall’s range seeks to
the lower bound, so this reads only keys >= from.
pub async fn prefix_keys( &self, prefix: impl Into<Vec<u8>>, ) -> Result<Vec<Vec<u8>>, AppError>
pub async fn approximate_len(&self) -> Result<usize, AppError>
pub async fn swap<V: Serialize>( &self, old_key: impl Into<Vec<u8>>, new_key: impl Into<Vec<u8>>, value: &V, ) -> Result<bool, AppError>
Trait Implementations§
Source§impl Clone for LocalKeyspaceHandle
impl Clone for LocalKeyspaceHandle
Source§fn clone(&self) -> LocalKeyspaceHandle
fn clone(&self) -> LocalKeyspaceHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more