Crate ocra

Source
Expand description

OCRA: (A) (R)ust (C)ache implementation for arrow-rs (O)bjectStore.

It offers a few ObjectStore implementations that work with caches.

For example, you can use ReadThroughCache to wrap an existing ObjectStore instance with a PageCache.

use object_store::{ObjectStore, local::LocalFileSystem, path::Path};
use ocra::{ReadThroughCache, memory::InMemoryCache};

let fs = Arc::new(LocalFileSystem::new());
// Use 75% of system memory for cache
let memory_cache = Arc::new(
    InMemoryCache::with_sys_memory(0.75).build());
let cached_store: Arc<dyn ObjectStore> =
    Arc::new(ReadThroughCache::new(fs, memory_cache));

// Now you can use `cached_store` as a regular ObjectStore
let path = Path::from("my-key");
let data = cached_store.get_range(&path, 1024..2048).await.unwrap();

Modules§

memory
In-memory PageCache implementation
paging
Trait for page cache
stats
Cache stats

Structs§

ReadThroughCache
Read-through Page Cache.

Enums§

Error
A specialized Error for object store-related errors

Type Aliases§

Result
A specialized Result for object store-related errors