pub trait StorageTxn {
// Required methods
fn get_collection_metadata(&self) -> BTreeMap<GlobalId, ShardId>;
fn insert_collection_metadata(
&mut self,
s: BTreeMap<GlobalId, ShardId>,
) -> Result<(), StorageError>;
fn delete_collection_metadata(
&mut self,
ids: BTreeSet<GlobalId>,
) -> Vec<(GlobalId, ShardId)>;
fn get_unfinalized_shards(&self) -> BTreeSet<ShardId>;
fn insert_unfinalized_shards(
&mut self,
s: BTreeSet<ShardId>,
) -> Result<(), StorageError>;
fn remove_unfinalized_shards(&mut self, shards: BTreeSet<ShardId>);
fn get_txn_wal_shard(&self) -> Option<ShardId>;
fn write_txn_wal_shard(
&mut self,
shard: ShardId,
) -> Result<(), StorageError>;
}Expand description
Provides an interface for the storage controller to read and write data that is recorded elsewhere.
Data written to the implementor of this trait should make a consistent view
of the data available through StorageMetadata.
Required Methods§
Sourcefn get_collection_metadata(&self) -> BTreeMap<GlobalId, ShardId>
fn get_collection_metadata(&self) -> BTreeMap<GlobalId, ShardId>
Retrieve all of the visible storage metadata.
The value of this map should be treated as opaque.
Sourcefn insert_collection_metadata(
&mut self,
s: BTreeMap<GlobalId, ShardId>,
) -> Result<(), StorageError>
fn insert_collection_metadata( &mut self, s: BTreeMap<GlobalId, ShardId>, ) -> Result<(), StorageError>
Add new storage metadata for a collection.
Subsequent calls to StorageTxn::get_collection_metadata must include
this data.
Sourcefn delete_collection_metadata(
&mut self,
ids: BTreeSet<GlobalId>,
) -> Vec<(GlobalId, ShardId)>
fn delete_collection_metadata( &mut self, ids: BTreeSet<GlobalId>, ) -> Vec<(GlobalId, ShardId)>
Remove the metadata associated with the identified collections.
Subsequent calls to StorageTxn::get_collection_metadata must not
include these keys.
Sourcefn get_unfinalized_shards(&self) -> BTreeSet<ShardId>
fn get_unfinalized_shards(&self) -> BTreeSet<ShardId>
Retrieve the durable set of shards recorded as unfinalized.
Entries must be reconciled with active collection metadata before finalization because stale entries can refer to active collections.
Sourcefn insert_unfinalized_shards(
&mut self,
s: BTreeSet<ShardId>,
) -> Result<(), StorageError>
fn insert_unfinalized_shards( &mut self, s: BTreeSet<ShardId>, ) -> Result<(), StorageError>
Insert the specified values as unfinalized shards.
Sourcefn remove_unfinalized_shards(&mut self, shards: BTreeSet<ShardId>)
fn remove_unfinalized_shards(&mut self, shards: BTreeSet<ShardId>)
Removes the specified shards from the unfinalized shard collection.
Missing shards are ignored. This only updates transaction metadata and does not finalize the underlying Persist shards.
Sourcefn get_txn_wal_shard(&self) -> Option<ShardId>
fn get_txn_wal_shard(&self) -> Option<ShardId>
Get the txn WAL shard for this environment if it exists.
Sourcefn write_txn_wal_shard(&mut self, shard: ShardId) -> Result<(), StorageError>
fn write_txn_wal_shard(&mut self, shard: ShardId) -> Result<(), StorageError>
Store the specified shard as the environment’s txn WAL shard.
The implementor should error if the shard is already specified.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".