#object-store #cache #arrow

ocra

OCRA: A Rust implementation of Cache in arrow-rs' ObjectStore interface

2 releases

0.1.1 Dec 7, 2024
0.1.0 Nov 30, 2024

#167 in Caching

Download history 124/week @ 2024-11-25 124/week @ 2024-12-02 41/week @ 2024-12-09

289 downloads per month

Custom license

32KB
667 lines

OCRA

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


lib.rs:

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();

Dependencies

~13–24MB
~342K SLoC