Trait scrypto_test::prelude::CommitableSubstateStore
source · 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§
sourcefn mark_as_transient(
&mut self,
node_id: NodeId,
partition_num: PartitionNumber,
substate_key: SubstateKey
)
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
sourcefn create_node<E, F>(
&mut self,
node_id: NodeId,
node_substates: BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>,
on_io_access: &mut F
) -> Result<(), E>
fn create_node<E, F>( &mut self, node_id: NodeId, node_substates: BTreeMap<PartitionNumber, BTreeMap<SubstateKey, IndexedScryptoValue>>, 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
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>
sourcefn 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>
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>
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.
fn force_write( &mut self, node_id: &NodeId, partition_num: &PartitionNumber, substate_key: &SubstateKey )
sourcefn remove_substate<E, F>(
&mut self,
node_id: &NodeId,
partition_num: PartitionNumber,
substate_key: &SubstateKey,
on_io_access: &mut F
) -> Result<Option<IndexedScryptoValue>, E>
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>
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.
sourcefn scan_keys<K, E, F>(
&mut self,
node_id: &NodeId,
partition_num: PartitionNumber,
count: u32,
on_io_access: &mut F
) -> Result<Vec<SubstateKey>, 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>
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
sourcefn 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>
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>
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
sourcefn 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>
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>
Returns tuple of substate vector and boolean which is true for the first database access.
sourcefn delete_partition(&mut self, node_id: &NodeId, partition_num: PartitionNumber)
fn delete_partition(&mut self, node_id: &NodeId, partition_num: PartitionNumber)
Note: unstable interface, for intent transaction tracker only
sourcefn get_commit_info(&mut self) -> Vec<StoreCommit>
fn get_commit_info(&mut self) -> Vec<StoreCommit>
Return the commit info