pub struct StateUpdates {
pub by_node: IndexMap<NodeId, NodeStateUpdates>,
}
Expand description
A tree-like description of all updates that happened to a stored state, to be included as a part
of a transaction receipt.
This structure is indexed (i.e. uses IndexMap
s where Vec
s could be used) for convenience
and performance, since both the source (i.e. Track) and the sink (i.e. Database and API) operate
on indexed structures too.
This structure maintains partial information on the order of operations (please see individual
fields for details), since the end users care about it. Please note that this means multiple
instances of StateUpdates
can represent the same transform of state store (i.e. differing
only by order of some operations), and hence it is not 100% “canonical form”.
Fields§
§by_node: IndexMap<NodeId, NodeStateUpdates>
Indexed Node-level updates, captured in the order of first update operation to a Node.
Implementations§
Source§impl StateUpdates
impl StateUpdates
pub fn empty() -> Self
Sourcepub fn of_node(&mut self, node_id: impl Into<NodeId>) -> &mut NodeStateUpdates
pub fn of_node(&mut self, node_id: impl Into<NodeId>) -> &mut NodeStateUpdates
Starts a Node-level update.
pub fn set_node_updates( self, node_id: impl Into<NodeId>, node_updates: NodeStateUpdates, ) -> Self
pub fn set_substate<'a>( self, node_id: impl Into<NodeId>, partition_num: PartitionNumber, substate_key: impl ResolvableSubstateKey<'a>, new_value: impl ScryptoEncode, ) -> Self
pub fn rebuild_without_empty_entries(self) -> Self
Sourcepub fn into_flattened_substate_updates(
self,
) -> IndexMap<(NodeId, PartitionNumber, SubstateKey), DatabaseUpdate>
pub fn into_flattened_substate_updates( self, ) -> IndexMap<(NodeId, PartitionNumber, SubstateKey), DatabaseUpdate>
Roughly equivalent to the LegacyStateUpdates (when they existed), ignoring partition resets. Should only be used for tests, not e.g. for committing to a database.
Trait Implementations§
Source§impl<X: CustomValueKind> Categorize<X> for StateUpdates
impl<X: CustomValueKind> Categorize<X> for StateUpdates
fn value_kind() -> ValueKind<X>
Source§impl Clone for StateUpdates
impl Clone for StateUpdates
Source§fn clone(&self) -> StateUpdates
fn clone(&self) -> StateUpdates
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StateUpdates
impl Debug for StateUpdates
Source§impl<D: Decoder<X>, X: CustomValueKind> Decode<X, D> for StateUpdates
impl<D: Decoder<X>, X: CustomValueKind> Decode<X, D> for StateUpdates
Source§fn decode_body_with_value_kind(
decoder: &mut D,
value_kind: ValueKind<X>,
) -> Result<Self, DecodeError>
fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<X>, ) -> Result<Self, DecodeError>
Source§impl Default for StateUpdates
impl Default for StateUpdates
Source§fn default() -> StateUpdates
fn default() -> StateUpdates
Source§impl<C: CustomTypeKind<RustTypeId>> Describe<C> for StateUpdates
impl<C: CustomTypeKind<RustTypeId>> Describe<C> for StateUpdates
Source§const TYPE_ID: RustTypeId
const TYPE_ID: RustTypeId
TYPE_ID
should give a unique identifier for its SBOR schema type.
An SBOR schema type capture details about the SBOR payload, how it should be interpreted, validated and displayed. Read moreSource§fn type_data() -> TypeData<C, RustTypeId>
fn type_data() -> TypeData<C, RustTypeId>
Source§fn add_all_dependencies(aggregator: &mut TypeAggregator<C>)
fn add_all_dependencies(aggregator: &mut TypeAggregator<C>)
get_local_type_data
, we need to ensure that the type and all of its own references
get added to the aggregator. Read moreSource§impl<E: Encoder<X>, X: CustomValueKind> Encode<X, E> for StateUpdates
impl<E: Encoder<X>, X: CustomValueKind> Encode<X, E> for StateUpdates
Source§fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
Source§fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
Source§impl PartialEq for StateUpdates
impl PartialEq for StateUpdates
Source§impl<X: CustomValueKind> SborTuple<X> for StateUpdates
impl<X: CustomValueKind> SborTuple<X> for StateUpdates
fn get_length(&self) -> usize
impl Eq for StateUpdates
impl StructuralPartialEq for StateUpdates
Auto Trait Implementations§
impl Freeze for StateUpdates
impl RefUnwindSafe for StateUpdates
impl Send for StateUpdates
impl Sync for StateUpdates
impl Unpin for StateUpdates
impl UnwindSafe for StateUpdates
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
type Error = <U as ContextualTryFrom<T>>::Error
type Context = <U as ContextualTryFrom<T>>::Context
fn contextual_try_into( self, context: &<U as ContextualTryFrom<T>>::Context, ) -> Result<U, <U as ContextualTryFrom<T>>::Error>
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.