#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

#238 in Caching

Download history 137/week @ 2024-11-28 130/week @ 2024-12-05 22/week @ 2024-12-12 4/week @ 2025-01-02 5/week @ 2025-01-09 5/week @ 2025-01-30 162/week @ 2025-02-06 107/week @ 2025-02-13

274 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

~12–40MB
~591K SLoC