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() -> StateUpdates
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, ) -> StateUpdates
pub fn set_substate<'a>( self, node_id: impl Into<NodeId>, partition_num: PartitionNumber, substate_key: impl ResolvableSubstateKey<'a>, new_value: impl ScryptoEncode, ) -> StateUpdates
pub fn rebuild_without_empty_entries(self) -> StateUpdates
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> Categorize<X> for StateUpdateswhere
X: CustomValueKind,
impl<X> Categorize<X> for StateUpdateswhere
X: CustomValueKind,
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 CreateDatabaseUpdates for StateUpdates
impl CreateDatabaseUpdates for StateUpdates
type DatabaseUpdates = DatabaseUpdates
Source§fn create_database_updates_with_mapper<M>(&self) -> DatabaseUpdateswhere
M: DatabaseKeyMapper,
fn create_database_updates_with_mapper<M>(&self) -> DatabaseUpdateswhere
M: DatabaseKeyMapper,
DatabaseKeyMapper
to express self using database-level key encoding.Source§fn create_database_updates(&self) -> Self::DatabaseUpdates
fn create_database_updates(&self) -> Self::DatabaseUpdates
DatabaseKeyMapper
, SpreadPrefixKeyMapper
, to express self using database-level key encoding.Source§impl Debug for StateUpdates
impl Debug for StateUpdates
Source§impl<D, X> Decode<X, D> for StateUpdateswhere
D: Decoder<X>,
X: CustomValueKind,
impl<D, X> Decode<X, D> for StateUpdateswhere
D: Decoder<X>,
X: CustomValueKind,
Source§fn decode_body_with_value_kind(
decoder: &mut D,
value_kind: ValueKind<X>,
) -> Result<StateUpdates, DecodeError>
fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<X>, ) -> Result<StateUpdates, DecodeError>
Source§impl Default for StateUpdates
impl Default for StateUpdates
Source§fn default() -> StateUpdates
fn default() -> StateUpdates
Source§impl<C> Describe<C> for StateUpdateswhere
C: CustomTypeKind<RustTypeId>,
impl<C> Describe<C> for StateUpdateswhere
C: CustomTypeKind<RustTypeId>,
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, X> Encode<X, E> for StateUpdateswhere
E: Encoder<X>,
X: CustomValueKind,
impl<E, X> Encode<X, E> for StateUpdateswhere
E: Encoder<X>,
X: CustomValueKind,
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> SborTuple<X> for StateUpdateswhere
X: CustomValueKind,
impl<X> SborTuple<X> for StateUpdateswhere
X: CustomValueKind,
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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.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.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more