Skip to main content

ColumnarSegmentExt

Trait ColumnarSegmentExt 

Source
pub trait ColumnarSegmentExt: Send + Sync {
    // Required methods
    fn write_columnar_segment<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        segment_id: u32,
        bytes: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), LiteError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn open_columnar_segment<'life0, 'life1, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        segment_id: u32,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Box<[u8]>>, LiteError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_columnar_segment<'life0, 'life1, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        segment_id: u32,
    ) -> Pin<Box<dyn Future<Output = Result<(), LiteError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Extension trait: write, open, and delete columnar segment data backed by pagedb encrypted segment files.

One segment per (collection, segment_id) pair. The segment contains the serialized columnar bytes exactly as produced by nodedb_columnar::SegmentWriter — no additional framing beyond the 8-byte length prefix envelope used to survive pagedb’s page-boundary padding.

Segment metadata (the ordered list of segment IDs with row counts), delete bitmaps, and collection schemas remain on the B+ tree (Namespace::Columnar and Namespace::Meta) — they are small and point-lookup hot.

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

Required Methods§

Source

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

Write the segment bytes for (collection, segment_id).

Chunks the length-prefixed payload into 4 KiB pagedb pages, creates a new encrypted segment, and links it under col/seg/{collection}/{segment_id}. 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_columnar_segment<'life0, 'life1, 'async_trait>( &'life0 self, collection: &'life1 str, segment_id: u32, ) -> Pin<Box<dyn Future<Output = Result<Option<Box<[u8]>>, LiteError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open a previously written columnar segment for (collection, segment_id).

Returns the raw segment bytes in a Box<[u8]>, identical to the bytes passed to write_columnar_segment.

Returns None if no segment exists under col/seg/{collection}/{segment_id}.

Source

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

Delete the columnar segment for (collection, segment_id).

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> ColumnarSegmentExt for PagedbStorage<V>
where <V as Vfs>::LockHandle: Sync, <V as Vfs>::File: Sync,