pub struct Freezer<E: Storage + Metrics + Clock, K: Array, V: Codec> { /* private fields */ }
Expand description
Implementation of Freezer.
Implementations§
Source§impl<E: Storage + Metrics + Clock, K: Array, V: Codec> Freezer<E, K, V>
impl<E: Storage + Metrics + Clock, K: Array, V: Codec> 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.
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.
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>where
V: Send,
impl<E, K, V> Sync for Freezer<E, K, V>where
V: Sync,
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