pub trait SubstateDatabase {
    // Required methods
    fn get_substate(
        &self,
        partition_key: &DbPartitionKey,
        sort_key: &DbSortKey
    ) -> Option<Vec<u8>>;
    fn list_entries_from(
        &self,
        partition_key: &DbPartitionKey,
        from_sort_key: Option<&DbSortKey>
    ) -> Box<dyn Iterator<Item = (DbSortKey, Vec<u8>)> + '_>;

    // Provided method
    fn list_entries(
        &self,
        partition_key: &DbPartitionKey
    ) -> Box<dyn Iterator<Item = (DbSortKey, Vec<u8>)> + '_> { ... }
}
Expand description

A read interface between Track and a database vendor.

Required Methods§

source

fn get_substate( &self, partition_key: &DbPartitionKey, sort_key: &DbSortKey ) -> Option<Vec<u8>>

Reads a substate value by its partition and sort key, or Option::None if missing.

source

fn list_entries_from( &self, partition_key: &DbPartitionKey, from_sort_key: Option<&DbSortKey> ) -> Box<dyn Iterator<Item = (DbSortKey, Vec<u8>)> + '_>

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.

Provided Methods§

source

fn list_entries( &self, partition_key: &DbPartitionKey ) -> Box<dyn Iterator<Item = (DbSortKey, Vec<u8>)> + '_>

Iterates over all entries of the given partition, in a lexicographical order (ascending) of the DbSortKeys. This is a convenience method, equivalent to Self::list_entries_from() with the starting key set to None.

Implementations on Foreign Types§

source§

impl<D> SubstateDatabase for HashTreeUpdatingDatabase<D>

source§

fn get_substate( &self, partition_key: &DbPartitionKey, sort_key: &DbSortKey ) -> Option<Vec<u8>>

source§

fn list_entries_from( &self, partition_key: &DbPartitionKey, from_sort_key: Option<&DbSortKey> ) -> Box<dyn Iterator<Item = (DbSortKey, Vec<u8>)> + '_>

Implementors§