Struct WarmStore

Source
pub struct WarmStore {
    dir: PathBuf,
    index: RwLock<BTreeMap<(u64, u32), Vec<i64>>>,
    zone_map: RwLock<ZoneManifest>,
    chunk_size: usize,
}
Expand description

Warm storage backend using partitioned files.

Fields§

§dir: PathBuf§index: RwLock<BTreeMap<(u64, u32), Vec<i64>>>

In-memory index: (entity_id, space_id) → sorted timestamps in this tier.

§zone_map: RwLock<ZoneManifest>

Zone map manifest for chunk-level temporal pruning.

§chunk_size: usize

Implementations§

Source§

impl WarmStore

Source

pub fn open(dir: &Path) -> Result<Self, StorageError>

Open or create a warm store at the given directory.

Source

fn load_zone_manifest(dir: &Path) -> Result<ZoneManifest, StorageError>

Source

fn persist_zone_manifest(&self) -> Result<(), StorageError>

Source

pub fn write_batch( &self, space_id: u32, points: &[TemporalPoint], ) -> Result<(), StorageError>

Write a batch of points to warm storage.

Points are grouped by (entity_id, space_id) and written to chunk files.

Source

fn read_entity_chunks( &self, entity_id: u64, space_id: u32, ) -> Result<Vec<TemporalPoint>, StorageError>

Read all points for an entity+space from chunk files.

Source

fn read_entity_chunks_filtered( &self, entity_id: u64, space_id: u32, start: i64, end: i64, ) -> Result<Vec<TemporalPoint>, StorageError>

Read entity chunks filtered by zone map — only opens chunks whose [min_ts, max_ts] overlaps with [start, end]. Falls back to full read if no zone map data exists.

Source

fn entity_dir(&self, entity_id: u64) -> PathBuf

Source

fn load_index(&self) -> Result<(), StorageError>

Source

pub fn contains(&self, entity_id: u64, space_id: u32, timestamp: i64) -> bool

Check if a point exists in warm storage.

Source

pub fn len(&self) -> usize

Number of points tracked in the index.

Source

pub fn is_empty(&self) -> bool

Whether the store is empty.

Trait Implementations§

Source§

impl StorageBackend for WarmStore

Source§

fn get( &self, entity_id: u64, space_id: u32, timestamp: i64, ) -> Result<Option<TemporalPoint>, StorageError>

Retrieve a single point by entity, space, and timestamp.
Source§

fn put(&self, space_id: u32, point: &TemporalPoint) -> Result<(), StorageError>

Store a temporal point.
Source§

fn range( &self, entity_id: u64, space_id: u32, start: i64, end: i64, ) -> Result<Vec<TemporalPoint>, StorageError>

Retrieve all points for an entity in a time range, ordered by timestamp.
Source§

fn delete( &self, entity_id: u64, space_id: u32, timestamp: i64, ) -> Result<(), StorageError>

Delete a specific point.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.