Expand description
Binary columnar event cache.
This module implements the binary cache format described in
docs/binary-cache-format.md. The cache is a derived, read-optimised
representation of the TSJSON event log. It is not authoritative — the
.events files are the source of truth — but enables sub-millisecond
replay on large repositories.
§Module layout
codec—ColumnCodectrait and per-column codec implementations.columns—CacheColumnsintermediate representation.CacheHeader— file header struct (this module).CacheError— error type (this module).
§Usage sketch
use bones_core::cache::{CacheHeader, CacheColumns};
// Build from events and encode to bytes:
// let cols = CacheColumns::from_events(&events)?;
// let header = CacheHeader::new(events.len() as u64);
// let bytes = header.encode(&cols)?;
// Decode from bytes:
// let (header, cols) = CacheHeader::decode(&bytes)?;
// let events = cols.into_events()?;Re-exports§
pub use codec::ColumnCodec;pub use codec::EventTypeCodec;pub use codec::InternedStringCodec;pub use codec::ItemIdCodec;pub use codec::RawBytesCodec;pub use codec::TimestampCodec;pub use codec::ValueCodec;pub use columns::COLUMN_COUNT;pub use columns::CacheColumns;pub use columns::ColumnRow;pub use manager::CacheManager;pub use manager::LoadResult;pub use manager::LoadSource;pub use reader::CacheReader;pub use reader::CacheReaderError;pub use writer::CacheStats;pub use writer::CacheWriter;pub use writer::rebuild_cache;
Modules§
- codec
- Column codec trait and implementations for the binary cache format.
- columns
- Per-column type definitions for the binary event cache.
- manager
- Cache lifecycle management: freshness check, rebuild trigger, fallback.
- reader
- Binary cache file reader.
- writer
- File I/O helpers for the binary columnar cache.
Structs§
- Cache
Header - File header for the binary event cache.
Enums§
- Cache
Error - Errors returned by cache encoding and decoding.
Constants§
- CACHE_
MAGIC - The four magic bytes at the start of every cache file.
- CACHE_
VERSION - The current format version written to new cache files.
- HEADER_
SIZE - File header size in bytes (fixed).
Functions§
- decode_
events - Decode binary cache bytes back to a vector of events.
- encode_
events - Encode a slice of events to binary cache bytes.