pub trait CommitableSubstateStore {
Show 13 methods // Required methods fn mark_as_transient( &mut self, node_id: NodeId, partition_num: PartitionNumber, substate_key: SubstateKey ); fn create_node<E, F>( &mut self, node_id: NodeId, node_substates: BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>, on_io_access: &mut F ) -> Result<(), E> where F: FnMut(IOAccess) -> Result<(), E>; fn get_tracked_substate_info( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey ) -> TrackedSubstateInfo; fn get_substate<E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, on_io_access: &mut F ) -> Result<Option<&IndexedScryptoValue>, E> where F: FnMut(IOAccess) -> Result<(), E>; fn set_substate<E, F>( &mut self, node_id: NodeId, partition_num: PartitionNumber, substate_key: SubstateKey, substate_value: IndexedScryptoValue, on_io_access: &mut F ) -> Result<(), E> where F: FnMut(IOAccess) -> Result<(), E>; fn force_write( &mut self, node_id: &NodeId, partition_num: &PartitionNumber, substate_key: &SubstateKey ); fn remove_substate<E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, on_io_access: &mut F ) -> Result<Option<IndexedScryptoValue>, E> where F: FnMut(IOAccess) -> Result<(), E>; fn scan_keys<K, E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<SubstateKey>, E> where K: SubstateKeyContent + 'static, F: FnMut(IOAccess) -> Result<(), E>; fn drain_substates<K, E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<(SubstateKey, IndexedScryptoValue)>, E> where K: SubstateKeyContent + 'static, F: FnMut(IOAccess) -> Result<(), E>; fn scan_sorted_substates<E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<(([u8; 2], Vec<u8>), IndexedScryptoValue)>, E> where F: FnMut(IOAccess) -> Result<(), E>; fn delete_partition( &mut self, node_id: &NodeId, partition_num: PartitionNumber ); fn get_commit_info(&mut self) -> Vec<StoreCommit>; // Provided method fn read_substate( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey ) -> Option<&IndexedScryptoValue> { ... }
}
Expand description

Represents the interface between Radix Engine and Track.

In practice, we will likely end up with only one implementation.

The trait here is for formalizing the interface and intended user flow.

Required Methods§

source

fn mark_as_transient( &mut self, node_id: NodeId, partition_num: PartitionNumber, substate_key: SubstateKey )

Marks a substate as transient, or a substate which was never and will never be persisted

source

fn create_node<E, F>( &mut self, node_id: NodeId, node_substates: BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>, on_io_access: &mut F ) -> Result<(), E>
where F: FnMut(IOAccess) -> Result<(), E>,

Inserts a node into the substate store.

Clients must ensure the node_id is new and unique; otherwise, the behavior is undefined.

§Panics
  • If the partition is invalid
source

fn get_tracked_substate_info( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey ) -> TrackedSubstateInfo

source

fn get_substate<E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, on_io_access: &mut F ) -> Result<Option<&IndexedScryptoValue>, E>
where F: FnMut(IOAccess) -> Result<(), E>,

source

fn set_substate<E, F>( &mut self, node_id: NodeId, partition_num: PartitionNumber, substate_key: SubstateKey, substate_value: IndexedScryptoValue, on_io_access: &mut F ) -> Result<(), E>
where F: FnMut(IOAccess) -> Result<(), E>,

Inserts a substate into the substate store.

Clients must ensure the node_id/partition_num is a node which has been created; otherwise, the behavior is undefined.

source

fn force_write( &mut self, node_id: &NodeId, partition_num: &PartitionNumber, substate_key: &SubstateKey )

source

fn remove_substate<E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, on_io_access: &mut F ) -> Result<Option<IndexedScryptoValue>, E>
where F: FnMut(IOAccess) -> Result<(), E>,

Deletes a substate from the substate store.

Clients must ensure the node_id/partition_num is a node which has been created; Clients must ensure this isn’t called on a virtualized partition; Otherwise, the behavior is undefined.

Returns tuple of substate and boolean which is true for the first database access.

source

fn scan_keys<K, E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<SubstateKey>, E>
where K: SubstateKeyContent + 'static, F: FnMut(IOAccess) -> Result<(), E>,

Returns Substate Keys of maximum count for a given partition.

Clients must ensure that the SubstateKeyContent which the partition is associated with is passed in. The returned SubstateKeys are guaranteed to be of this type. Otherwise, behavior is undefined.

Returns list of substate keys and database access info

source

fn drain_substates<K, E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<(SubstateKey, IndexedScryptoValue)>, E>
where K: SubstateKeyContent + 'static, F: FnMut(IOAccess) -> Result<(), E>,

Removes substates of maximum count for a given partition.

Clients must ensure that the SubstateKeyContent which the partition is associated with is passed in. The returned SubstateKeys are guaranteed to be of this type. Otherwise, behavior is undefined.

Returns list of removed substates with their associated keys and values, as well as database access info

source

fn scan_sorted_substates<E, F>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<(([u8; 2], Vec<u8>), IndexedScryptoValue)>, E>
where F: FnMut(IOAccess) -> Result<(), E>,

Returns tuple of substate vector and boolean which is true for the first database access.

source

fn delete_partition(&mut self, node_id: &NodeId, partition_num: PartitionNumber)

Note: unstable interface, for intent transaction tracker only

source

fn get_commit_info(&mut self) -> Vec<StoreCommit>

Return the commit info

Provided Methods§

source

fn read_substate( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey ) -> Option<&IndexedScryptoValue>

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'s, S, M> CommitableSubstateStore for Track<'s, S, M>
where S: SubstateDatabase, M: DatabaseKeyMapper + 'static,