Trait jj_lib::op_store::OpStore

source ·
pub trait OpStore: Send + Sync + Debug {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn name(&self) -> &str;
    fn root_operation_id(&self) -> &OperationId;
    fn read_view(&self, id: &ViewId) -> OpStoreResult<View>;
    fn write_view(&self, contents: &View) -> OpStoreResult<ViewId>;
    fn read_operation(&self, id: &OperationId) -> OpStoreResult<Operation>;
    fn write_operation(
        &self,
        contents: &Operation
    ) -> OpStoreResult<OperationId>;
    fn resolve_operation_id_prefix(
        &self,
        prefix: &HexPrefix
    ) -> OpStoreResult<PrefixResolution<OperationId>>;
    fn gc(
        &self,
        head_ids: &[OperationId],
        keep_newer: SystemTime
    ) -> OpStoreResult<()>;
}

Required Methods§

source

fn as_any(&self) -> &dyn Any

source

fn name(&self) -> &str

source

fn root_operation_id(&self) -> &OperationId

source

fn read_view(&self, id: &ViewId) -> OpStoreResult<View>

source

fn write_view(&self, contents: &View) -> OpStoreResult<ViewId>

source

fn read_operation(&self, id: &OperationId) -> OpStoreResult<Operation>

source

fn write_operation(&self, contents: &Operation) -> OpStoreResult<OperationId>

source

fn resolve_operation_id_prefix( &self, prefix: &HexPrefix ) -> OpStoreResult<PrefixResolution<OperationId>>

Resolves an unambiguous operation ID prefix.

source

fn gc( &self, head_ids: &[OperationId], keep_newer: SystemTime ) -> OpStoreResult<()>

Prunes unreachable operations and views.

All operations and views reachable from the head_ids won’t be removed. In addition to that, objects created after keep_newer will be preserved. This mitigates a risk of deleting new heads created concurrently by another process.

Implementors§