pub struct Freezer<E: Storage + Metrics + Clock, K: Array, V: CodecShared> { /* private fields */ }Expand description
Implementation of Freezer.
Implementations§
Source§impl<E: Storage + Metrics + Clock, K: Array, V: CodecShared> Freezer<E, K, V>
impl<E: Storage + Metrics + Clock, K: Array, V: CodecShared> Freezer<E, K, V>
Sourcepub async fn init(context: E, config: Config<V::Cfg>) -> Result<Self, Error>
pub async fn init(context: E, config: Config<V::Cfg>) -> Result<Self, Error>
Initialize a new Freezer instance.
Sourcepub async fn init_with_checkpoint(
context: E,
config: Config<V::Cfg>,
checkpoint: Option<Checkpoint>,
) -> Result<Self, Error>
pub async fn init_with_checkpoint( context: E, config: Config<V::Cfg>, checkpoint: Option<Checkpoint>, ) -> Result<Self, Error>
Initialize a new Freezer instance with a Checkpoint.
Sourcepub async fn put(&mut self, key: K, value: V) -> Result<Cursor, Error>
pub async fn put(&mut self, key: K, value: V) -> Result<Cursor, Error>
Put a key-value pair into the Freezer. If the key already exists, the value is updated.
Sourcepub async fn get<'a>(
&'a self,
identifier: Identifier<'a, K>,
) -> Result<Option<V>, Error>
pub async fn get<'a>( &'a self, identifier: Identifier<'a, K>, ) -> Result<Option<V>, Error>
Get the value for a given Identifier.
If a Cursor is known for the required key, it
is much faster to use it than searching for a key.
Sourcepub async fn sync(&mut self) -> Result<Checkpoint, Error>
pub async fn sync(&mut self) -> Result<Checkpoint, Error>
Sync all pending data in Freezer.
If the table needs to be resized, the resize will begin during this sync.
The resize operation is performed incrementally across multiple sync calls
to avoid a large latency spike (or unexpected long latency for Freezer::put).
Each sync will process up to table_resize_chunk_size entries until the resize
is complete.
Sourcepub async fn close(self) -> Result<Checkpoint, Error>
pub async fn close(self) -> Result<Checkpoint, Error>
Close the Freezer and return a Checkpoint for recovery.
Trait Implementations§
Source§impl<E: Storage + Metrics + Clock, K: Array, V: CodecShared> Persistable for Freezer<E, K, V>
impl<E: Storage + Metrics + Clock, K: Array, V: CodecShared> Persistable for Freezer<E, K, V>
Source§type Error = Error
type Error = Error
The error type returned when there is a failure from the underlying storage system.
Source§async fn commit(&mut self) -> Result<(), Self::Error>
async fn commit(&mut self) -> Result<(), Self::Error>
Durably persist the structure, guaranteeing the current state will survive a crash. Read more
Source§impl<E: Storage + Metrics + Clock, K: Array, V: CodecShared> Updatable for Freezer<E, K, V>
impl<E: Storage + Metrics + Clock, K: Array, V: CodecShared> Updatable for Freezer<E, K, V>
Source§async fn update(
&mut self,
key: Self::Key,
value: Self::Value,
) -> Result<(), Self::Error>
async fn update( &mut self, key: Self::Key, value: Self::Value, ) -> Result<(), Self::Error>
Update the value of a key.
Source§fn create<'a>(
&'a mut self,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<bool, Self::Error>> + Send + use<'a, Self>where
Self: Send,
fn create<'a>(
&'a mut self,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<bool, Self::Error>> + Send + use<'a, Self>where
Self: Send,
Creates a new key-value pair in the db. Returns true if the key was created, false if it
already existed. The key is not modified if it already existed.
Auto Trait Implementations§
impl<E, K, V> Freeze for Freezer<E, K, V>
impl<E, K, V> !RefUnwindSafe for Freezer<E, K, V>
impl<E, K, V> Send for Freezer<E, K, V>
impl<E, K, V> Sync for Freezer<E, K, V>
impl<E, K, V> Unpin for Freezer<E, K, V>
impl<E, K, V> !UnwindSafe for Freezer<E, K, V>
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