pub struct CacheStorage { /* private fields */ }Expand description
Cache storage for liquid cache.
Example (async read):
use liquid_cache_storage::cache::{CacheStorageBuilder, EntryID};
use arrow::array::UInt64Array;
use std::sync::Arc;
tokio_test::block_on(async {
let storage = CacheStorageBuilder::new().build();
let entry_id = EntryID::from(0);
let arrow_array = Arc::new(UInt64Array::from_iter_values(0..32));
storage.insert(entry_id, arrow_array.clone()).await;
// Get the arrow array back asynchronously
let retrieved = storage.get_arrow_array(&entry_id).await.unwrap();
assert_eq!(retrieved.as_ref(), arrow_array.as_ref());
});Implementations§
Source§impl CacheStorage
impl CacheStorage
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Return current cache statistics: counts and resource usage.
Sourcepub async fn insert(
self: &Arc<Self>,
entry_id: EntryID,
batch_to_cache: ArrayRef,
)
pub async fn insert( self: &Arc<Self>, entry_id: EntryID, batch_to_cache: ArrayRef, )
Insert a batch into the cache.
Sourcepub async fn get_arrow_array(&self, entry_id: &EntryID) -> Option<ArrayRef>
pub async fn get_arrow_array(&self, entry_id: &EntryID) -> Option<ArrayRef>
Get an Arrow array from the cache asynchronously.
Sourcepub async fn get_with_selection(
&self,
entry_id: &EntryID,
selection: &BooleanBuffer,
) -> Option<Result<ArrayRef, ArrowError>>
pub async fn get_with_selection( &self, entry_id: &EntryID, selection: &BooleanBuffer, ) -> Option<Result<ArrayRef, ArrowError>>
Get an Arrow array with selection pushdown.
Sourcepub async fn get_with_predicate(
&self,
entry_id: &EntryID,
selection: &BooleanBuffer,
predicate: &Arc<dyn PhysicalExpr>,
) -> Option<GetWithPredicateResult>
pub async fn get_with_predicate( &self, entry_id: &EntryID, selection: &BooleanBuffer, predicate: &Arc<dyn PhysicalExpr>, ) -> Option<GetWithPredicateResult>
Get with predicate pushdown.
Sourcepub async fn try_read_liquid(
&self,
entry_id: &EntryID,
) -> Option<LiquidArrayRef>
pub async fn try_read_liquid( &self, entry_id: &EntryID, ) -> Option<LiquidArrayRef>
Try to read a liquid array from the cache. Returns None if the cached data is not in liquid format.
Sourcepub fn for_each_entry(&self, f: impl FnMut(&EntryID, &CachedBatch))
pub fn for_each_entry(&self, f: impl FnMut(&EntryID, &CachedBatch))
Iterate over all entries in the cache. No guarantees are made about the order of the entries. Isolation level: read-committed
Sourcepub fn compressor_states(
&self,
entry_id: &EntryID,
) -> Arc<LiquidCompressorStates>
pub fn compressor_states( &self, entry_id: &EntryID, ) -> Arc<LiquidCompressorStates>
Get the compressor states of the cache.
Sourcepub fn flush_all_to_disk(&self)
pub fn flush_all_to_disk(&self)
Flush all entries to disk.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CacheStorage
impl !RefUnwindSafe for CacheStorage
impl Send for CacheStorage
impl Sync for CacheStorage
impl Unpin for CacheStorage
impl !UnwindSafe for CacheStorage
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request