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: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: NodeId, node_substates: NodeSubstates, on_io_access: &mut F ) -> Result<(), E>; fn get_tracked_substate_info( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey ) -> TrackedSubstateInfo; fn get_substate<E, F: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, on_io_access: &mut F ) -> Result<Option<&IndexedScryptoValue>, E>; fn set_substate<E, F: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: NodeId, partition_num: PartitionNumber, substate_key: SubstateKey, substate_value: IndexedScryptoValue, on_io_access: &mut F ) -> Result<(), E>; fn force_write( &mut self, node_id: &NodeId, partition_num: &PartitionNumber, substate_key: &SubstateKey ); fn remove_substate<E, F: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, on_io_access: &mut F ) -> Result<Option<IndexedScryptoValue>, E>; fn scan_keys<K: SubstateKeyContent + 'static, E, F: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<SubstateKey>, E>; fn drain_substates<K: SubstateKeyContent + 'static, E, F: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<(SubstateKey, IndexedScryptoValue)>, E>; fn scan_sorted_substates<E, F: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<(SortedKey, IndexedScryptoValue)>, E>; fn delete_partition( &mut self, node_id: &NodeId, partition_num: PartitionNumber ); fn get_commit_info(&mut self) -> StoreCommitInfo; // 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: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: NodeId, node_substates: NodeSubstates, on_io_access: &mut F ) -> 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: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, on_io_access: &mut F ) -> Result<Option<&IndexedScryptoValue>, E>

source

fn set_substate<E, F: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: NodeId, partition_num: PartitionNumber, substate_key: SubstateKey, substate_value: IndexedScryptoValue, on_io_access: &mut F ) -> 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: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, substate_key: &SubstateKey, on_io_access: &mut F ) -> Result<Option<IndexedScryptoValue>, 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: SubstateKeyContent + 'static, E, F: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<SubstateKey>, 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: SubstateKeyContent + 'static, E, F: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<(SubstateKey, IndexedScryptoValue)>, 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: FnMut(IOAccess) -> Result<(), E>>( &mut self, node_id: &NodeId, partition_num: PartitionNumber, count: u32, on_io_access: &mut F ) -> Result<Vec<(SortedKey, IndexedScryptoValue)>, 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) -> StoreCommitInfo

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§