jj_lib::op_store

Trait 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§