pub struct RedbBackend { /* private fields */ }Expand description
redb-backed durable state. Atomicity comes from redb’s single-writer write
transaction: each increment / try_acquire does its read-modify-write inside one
transaction (ADR 000004). redb is fully synchronous; ADR 000011’s async-aware seam
is this KvBackend impl — when host calls go async, the commits move to a blocking
pool here without touching callers.
Implementations§
Trait Implementations§
Source§impl KvBackend for RedbBackend
impl KvBackend for RedbBackend
fn get(&self, key: &[u8]) -> Option<Vec<u8>>
fn set(&self, key: &[u8], value: Vec<u8>)
fn delete(&self, key: &[u8])
Source§fn increment(&self, key: &[u8], delta: i64) -> i64
fn increment(&self, key: &[u8], delta: i64) -> i64
Atomic add-and-get. An unset counter starts at 0;
delta is signed.Source§fn try_acquire(
&self,
key: &[u8],
cost: u64,
spec: Bucket,
now_ms: u64,
) -> Acquire
fn try_acquire( &self, key: &[u8], cost: u64, spec: Bucket, now_ms: u64, ) -> Acquire
Atomic token-bucket acquire against the
now_ms request-clock snapshot. The
refill + counting stay host-native (ADR 000005) — they never cross the WASM
boundary; the filter only decided to consult the limiter.Auto Trait Implementations§
impl !Freeze for RedbBackend
impl !RefUnwindSafe for RedbBackend
impl !UnwindSafe for RedbBackend
impl Send for RedbBackend
impl Sync for RedbBackend
impl Unpin for RedbBackend
impl UnsafeUnpin for RedbBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more