Skip to main content

DagPersistent

Trait DagPersistent 

Source
pub trait DagPersistent {
    // Required methods
    fn flush<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        master_heads: &'life1 VertexListWithOptions,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn flush_cached_idmap<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_heads_and_flush<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 mut self,
        parent_names_func: &'life1 dyn Parents,
        heads: &'life2 VertexListWithOptions,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn import_and_flush<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        dag: &'life1 dyn DagAlgorithm,
        master_heads: Set,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Persistent the DAG on disk.

Required Methods§

Source

fn flush<'life0, 'life1, 'async_trait>( &'life0 mut self, master_heads: &'life1 VertexListWithOptions, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write in-memory DAG to disk. This might also pick up changes to the DAG by other processes.

Calling add_heads followed by flush is like calling add_heads_and_flush with the master_heads passed to flush concated with heads from add_heads. add_heads followed by flush is more flexible but less performant than add_heads_and_flush.

Source

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

Write in-memory IdMap that caches Id <-> Vertex translation from remote service to disk.

Source

fn add_heads_and_flush<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, parent_names_func: &'life1 dyn Parents, heads: &'life2 VertexListWithOptions, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add non-lazy vertexes, their ancestors, and vertexes added previously by add_heads on disk.

Reload and persist changes to disk (with lock) immediately. Does not error out if pending changes were added by add_heads.

heads should not use VIRTUAL as desired_group. heads are imported in the given order, followed by heads previously added by add_heads.

heads with reserve_size > 0 must be passed in even if they already exist and are not being added, for the id reservation to work correctly.

add_heads_and_flush is faster than add_heads. But add_heads can be useful for the VIRTUAL group, and when the final group is not yet decided (ex. the MASTER group is decided by remotenames info but remotenames is not yet known at add_heads time).

Provided Methods§

Source

fn import_and_flush<'life0, 'life1, 'async_trait>( &'life0 mut self, dag: &'life1 dyn DagAlgorithm, master_heads: Set, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Import from another (potentially large) DAG. Write to disk immediately.

Implementors§

Source§

impl<IS, M, P, S> DagPersistent for AbstractDag<IdDag<IS>, M, P, S>
where IS: IdDagStore + Persist + StorageVersion, IdDag<IS>: TryClone + 'static, M: TryClone + IdMapAssignHead + Persist + Send + Sync + 'static, P: Open<OpenTarget = Self> + Send + Sync + 'static, S: TryClone + StorageVersion + Persist + Send + Sync + 'static,