Skip to main content

SpatialSegmentExt

Trait SpatialSegmentExt 

Source
pub trait SpatialSegmentExt: Send + Sync {
    // Required methods
    fn write_spatial_segment<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        field: &'life2 str,
        bytes: &'life3 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), LiteError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn open_spatial_segment<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        field: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Box<[u8]>>, LiteError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn delete_spatial_segment<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        field: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), LiteError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Extension trait: write, open, and delete R-tree checkpoint segments backed by pagedb encrypted segment files.

One segment per (collection, field) pair (e.g. "orders", "location"). The segment contains the CRC32C-wrapped R-tree checkpoint bytes exactly as produced by crate::storage::checksum::wrap — no additional framing beyond the 8-byte length-prefix envelope used to survive pagedb’s page-boundary zero-padding.

This trait is object-safe so StorageEngine implementations can return Option<&dyn SpatialSegmentExt> via as_spatial_segment_ext().

Required Methods§

Source

fn write_spatial_segment<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, collection: &'life1 str, field: &'life2 str, bytes: &'life3 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), LiteError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Write the CRC32C-wrapped R-tree checkpoint blob for (collection, field).

Chunks the length-prefixed payload into 4 KiB pagedb pages, creates a new encrypted segment, and links it under spatial/rtree/{collection}/{field}. If a segment already exists under that name it is atomically replaced (old segment is tombstoned and reaped by the next Db::gc_now call).

Source

fn open_spatial_segment<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection: &'life1 str, field: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Box<[u8]>>, LiteError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Open a previously written R-tree segment for (collection, field).

Returns the CRC32C-wrapped R-tree checkpoint bytes in a Box<[u8]>, identical to the bytes passed to write_spatial_segment.

Returns None if no segment exists under spatial/rtree/{collection}/{field}.

Source

fn delete_spatial_segment<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection: &'life1 str, field: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), LiteError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete the R-tree segment for (collection, field).

No-op if no segment exists. The segment file is tombstoned and reaped by the next Db::gc_now cycle.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<V: Vfs + Clone + Send + Sync + 'static> SpatialSegmentExt for PagedbStorage<V>
where <V as Vfs>::LockHandle: Sync, <V as Vfs>::File: Sync,