Trait mz_storage_client::controller::StorageTxn
source · pub trait StorageTxn<T> {
// Required methods
fn get_collection_metadata(&self) -> BTreeMap<GlobalId, String>;
fn insert_collection_metadata(
&mut self,
s: BTreeMap<GlobalId, String>
) -> Result<(), StorageError<T>>;
fn delete_collection_metadata(
&mut self,
ids: BTreeSet<GlobalId>
) -> Vec<(GlobalId, String)>;
fn get_unfinalized_shards(&self) -> BTreeSet<String>;
fn insert_unfinalized_shards(
&mut self,
s: BTreeSet<String>
) -> Result<(), StorageError<T>>;
fn mark_shards_as_finalized(&mut self, shards: BTreeSet<String>);
fn get_persist_txn_shard(&self) -> Option<String>;
fn write_persist_txn_shard(
&mut self,
shard: String
) -> Result<(), StorageError<T>>;
}
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, String>
fn get_collection_metadata(&self) -> BTreeMap<GlobalId, String>
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, String>
) -> Result<(), StorageError<T>>
fn insert_collection_metadata( &mut self, s: BTreeMap<GlobalId, String> ) -> Result<(), StorageError<T>>
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, String)>
fn delete_collection_metadata( &mut self, ids: BTreeSet<GlobalId> ) -> Vec<(GlobalId, String)>
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<String>
fn get_unfinalized_shards(&self) -> BTreeSet<String>
Retrieve all of the shards that are no longer in use by an active collection but are yet to be finalized.
sourcefn insert_unfinalized_shards(
&mut self,
s: BTreeSet<String>
) -> Result<(), StorageError<T>>
fn insert_unfinalized_shards( &mut self, s: BTreeSet<String> ) -> Result<(), StorageError<T>>
Insert the specified values as unfinalized shards.
sourcefn mark_shards_as_finalized(&mut self, shards: BTreeSet<String>)
fn mark_shards_as_finalized(&mut self, shards: BTreeSet<String>)
Mark the specified shards as finalized, deleting them from the unfinalized shard collection.
sourcefn get_persist_txn_shard(&self) -> Option<String>
fn get_persist_txn_shard(&self) -> Option<String>
Get the persist txn shard for this environment if it exists.
sourcefn write_persist_txn_shard(
&mut self,
shard: String
) -> Result<(), StorageError<T>>
fn write_persist_txn_shard( &mut self, shard: String ) -> Result<(), StorageError<T>>
Store the specified shard as the environment’s persist txn shard.
The implementor should error if the shard is already specified.