pub struct Store<E, K, V, T>{ /* private fields */ }Expand description
An unauthenticated key-value database based off of an append-only VJournal of operations.
Implementations§
Source§impl<E, K, V, T> Store<E, K, V, T>
impl<E, K, V, T> Store<E, K, V, T>
Sourcepub async fn init(
context: E,
cfg: Config<T, <Operation<K, V> as Read>::Cfg>,
) -> Result<Self, Error>
pub async fn init( context: E, cfg: Config<T, <Operation<K, V> as Read>::Cfg>, ) -> Result<Self, Error>
Sourcepub async fn get(&self, key: &K) -> Result<Option<V>, Error>
pub async fn get(&self, key: &K) -> Result<Option<V>, Error>
Gets the value associated with the given key in the store.
If the key does not exist, returns Ok(None).
Sourcepub async fn update(&mut self, key: K, value: V) -> Result<(), Error>
pub async fn update(&mut self, key: K, value: V) -> Result<(), Error>
Updates the value associated with the given key in the store.
The operation is immediately visible in the snapshot for subsequent queries, but remains uncommitted until Store::commit is called. Uncommitted operations will be rolled back if the store is closed without committing.
Sourcepub async fn delete(&mut self, key: K) -> Result<(), Error>
pub async fn delete(&mut self, key: K) -> Result<(), Error>
Deletes the value associated with the given key in the store. If the key has no value, the operation is a no-op.
Sourcepub async fn commit(&mut self) -> Result<(), Error>
pub async fn commit(&mut self) -> Result<(), Error>
Commits all uncommitted operations to the store, making them persistent and recoverable.
Sourcepub async fn close(self) -> Result<(), Error>
pub async fn close(self) -> Result<(), Error>
Closes the store. Any uncommitted operations will be lost if they have not been committed via Store::commit.
Auto Trait Implementations§
impl<E, K, V, T> Freeze for Store<E, K, V, T>
impl<E, K, V, T> !RefUnwindSafe for Store<E, K, V, T>
impl<E, K, V, T> Send for Store<E, K, V, T>
impl<E, K, V, T> Sync for Store<E, K, V, T>
impl<E, K, V, T> Unpin for Store<E, K, V, T>
impl<E, K, V, T> !UnwindSafe for Store<E, K, V, T>
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
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>
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>
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