pub trait SubstateDatabase {
// Required methods
fn get_substate(
&self,
partition_key: &DbPartitionKey,
sort_key: &DbSortKey
) -> Option<DbSubstateValue>;
fn list_entries_from(
&self,
partition_key: &DbPartitionKey,
from_sort_key: Option<&DbSortKey>
) -> Box<dyn Iterator<Item = PartitionEntry> + '_>;
// Provided method
fn list_entries(
&self,
partition_key: &DbPartitionKey
) -> Box<dyn Iterator<Item = PartitionEntry> + '_> { ... }
}
Expand description
A read interface between Track and a database vendor.
Required Methods§
sourcefn get_substate(
&self,
partition_key: &DbPartitionKey,
sort_key: &DbSortKey
) -> Option<DbSubstateValue>
fn get_substate( &self, partition_key: &DbPartitionKey, sort_key: &DbSortKey ) -> Option<DbSubstateValue>
Reads a substate value by its partition and sort key, or Option::None
if missing.
sourcefn list_entries_from(
&self,
partition_key: &DbPartitionKey,
from_sort_key: Option<&DbSortKey>
) -> Box<dyn Iterator<Item = PartitionEntry> + '_>
fn list_entries_from( &self, partition_key: &DbPartitionKey, from_sort_key: Option<&DbSortKey> ) -> Box<dyn Iterator<Item = PartitionEntry> + '_>
Provided Methods§
sourcefn list_entries(
&self,
partition_key: &DbPartitionKey
) -> Box<dyn Iterator<Item = PartitionEntry> + '_>
fn list_entries( &self, partition_key: &DbPartitionKey ) -> Box<dyn Iterator<Item = PartitionEntry> + '_>
Iterates over all entries of the given partition, in a lexicographical order (ascending)
of the DbSortKey
s.
This is a convenience method, equivalent to Self::list_entries_from()
with the starting
key set to None
.