pub trait SubstateDatabase {
// Required methods
fn get_raw_substate_by_db_key(
&self,
partition_key: &DbPartitionKey,
sort_key: &DbSortKey,
) -> Option<DbSubstateValue>;
fn list_raw_values_from_db_key(
&self,
partition_key: &DbPartitionKey,
from_sort_key: Option<&DbSortKey>,
) -> Box<dyn Iterator<Item = PartitionEntry> + '_>;
}Expand description
A read interface between Track and a database vendor.
Required Methods§
Sourcefn get_raw_substate_by_db_key(
&self,
partition_key: &DbPartitionKey,
sort_key: &DbSortKey,
) -> Option<DbSubstateValue>
fn get_raw_substate_by_db_key( &self, partition_key: &DbPartitionKey, sort_key: &DbSortKey, ) -> Option<DbSubstateValue>
Reads a substate value by its db partition and db sort key, or Option::None if missing.
§Alternatives
It’s likely easier to use the get_substate or
get_raw_substate methods instead, which
allow providing logical keys.
These methods should also exist on the database type as long as the
SubstateDatabaseExtensions trait is in scope.
Sourcefn list_raw_values_from_db_key(
&self,
partition_key: &DbPartitionKey,
from_sort_key: Option<&DbSortKey>,
) -> Box<dyn Iterator<Item = PartitionEntry> + '_>
fn list_raw_values_from_db_key( &self, partition_key: &DbPartitionKey, from_sort_key: Option<&DbSortKey>, ) -> Box<dyn Iterator<Item = PartitionEntry> + '_>
Iterates over all entries of the given partition (starting either from the beginning, or
from the given DbSortKey), in a lexicographical order (ascending) of the DbSortKeys.
Note: If the exact given starting key does not exist, the iteration starts with its
immediate successor.
§Alternatives
There are lots of methods starting list_ which allow iterating using more intuitive abstractions.
These methods are present as long as the SubstateDatabaseExtensions trait is in scope.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".