pub struct Freezer<E: BufferPooler + Context, K: Array, V: CodecShared> { /* private fields */ }Expand description
Implementation of Freezer.
Implementations§
Source§impl<E: BufferPooler + Context, K: Array, V: CodecShared> Freezer<E, K, V>
impl<E: BufferPooler + Context, K: Array, V: CodecShared> Freezer<E, K, V>
Sourcepub async fn init(
context: E,
config: Config<V::Cfg>,
checkpoint: Option<Checkpoint>,
) -> Result<Self, Error>
pub async fn init( context: E, config: Config<V::Cfg>, checkpoint: Option<Checkpoint>, ) -> Result<Self, Error>
Initialize a Freezer instance, aligning existing data to a Checkpoint when provided.
Passing None or an empty Checkpoint deletes any existing freezer data and starts empty.
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 has(&self, key: &K) -> Result<bool, Error>
pub async fn has(&self, key: &K) -> Result<bool, Error>
Check whether a value exists for a given key.
Walks the same key index chain as Self::get with Identifier::Key
but never reads values.
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> !RefUnwindSafe for Freezer<E, K, V>
impl<E, K, V> !UnwindSafe for Freezer<E, K, V>
impl<E, K, V> Freeze 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> UnsafeUnpin 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
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>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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