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§
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>
sourcefn resolve_operation_id_prefix(
&self,
prefix: &HexPrefix
) -> OpStoreResult<PrefixResolution<OperationId>>
fn resolve_operation_id_prefix( &self, prefix: &HexPrefix ) -> OpStoreResult<PrefixResolution<OperationId>>
Resolves an unambiguous operation ID prefix.
sourcefn gc(
&self,
head_ids: &[OperationId],
keep_newer: SystemTime
) -> OpStoreResult<()>
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.