Skip to main content

GraphSegmentExt

Trait GraphSegmentExt 

Source
pub trait GraphSegmentExt: Send + Sync {
    // Required methods
    fn write_graph_segment<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
        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_graph_segment<'life0, 'life1, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
    ) -> 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_graph_segment<'life0, 'life1, 'async_trait>(
        &'life0 self,
        collection: &'life1 str,
    ) -> 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 CSR adjacency segments backed by pagedb encrypted segment files.

One segment per collection (e.g. "social_graph"). The segment contains the serialized CSR checkpoint bytes exactly as produced by CsrIndex::checkpoint_to_bytes() — 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 GraphSegmentExt> via as_graph_segment_ext().

Required Methods§

Source

fn write_graph_segment<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, collection: &'life1 str, 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 CSR checkpoint blob for collection.

Chunks the length-prefixed payload into 4 KiB pagedb pages, creates a new encrypted segment, and links it under graph/csr/{collection}. 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_graph_segment<'life0, 'life1, 'async_trait>( &'life0 self, collection: &'life1 str, ) -> 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 CSR segment for collection.

Returns the raw CSR checkpoint bytes in a Box<[u8]>, identical to the bytes passed to write_graph_segment.

Returns None if no segment exists under graph/csr/{collection}.

Source

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

Delete the CSR segment for collection.

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