Skip to main content

PageStore

Trait PageStore 

Source
pub trait PageStore: Send {
    // Required methods
    fn put(&mut self, value: Bytes) -> Result<PageKey>;
    fn take(&mut self, key: PageKey) -> Result<Bytes>;

    // Provided method
    fn memory_size(&self) -> usize { ... }
}
Expand description

A pluggable store for completed, serialized page blobs.

The store is intentionally “dumb”: it only maps an opaque PageKey to a blob of bytes. It knows nothing about pages, dictionaries, ordering, or offsets. The caller keeps the handles it gets back from put and decides what they mean.

Each store instance is owned by a single column writer and mutated by one thread at a time (both methods take &mut self), so it needs no internal synchronization — hence only Send, not Sync.

The default (InMemoryPageStore) keeps blobs on the heap. Configure a different backend via ArrowWriterOptions::with_page_store_factory.

Required Methods§

Source

fn put(&mut self, value: Bytes) -> Result<PageKey>

Store value, returning a handle that can later be passed to take.

Source

fn take(&mut self, key: PageKey) -> Result<Bytes>

Take back the blob previously stored under key.

The caller takes ownership of the returned bytes and will not request key again, so the store may release any resources backing it — eagerly here, or when the store is dropped.

Provided Methods§

Source

fn memory_size(&self) -> usize

The number of bytes this store currently holds in memory (resident on the heap), used to report the writer’s memory footprint.

The default is 0, which is exactly right for a backend that moves every blob off-heap (a temp file, object storage): the bytes it has been handed no longer occupy heap. The in-memory backend overrides this to report its resident blobs. A backend that keeps a partial in-memory buffer should report that buffer’s size.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§