Struct diem_sdk::types::block_metadata::BlockMetadata
pub struct BlockMetadata { /* private fields */ }
Expand description
Struct that will be persisted on chain to store the information of the current block.
The flow will look like following:
- The executor will pass this struct to VM at the end of a block proposal.
- The VM will use this struct to create a special system transaction that will emit an event represents the information of the current block. This transaction can’t be emitted by regular users and is generated by each of the validators on the fly. Such transaction will be executed before all of the user-submitted transactions in the blocks.
- Once that special resource is modified, the other user transactions can read the consensus info by calling into the read method of that resource, which would thus give users the information such as the current leader.
Implementations§
§impl BlockMetadata
impl BlockMetadata
pub fn new( id: HashValue, round: u64, timestamp_usecs: u64, previous_block_votes: Vec<AccountAddress, Global>, proposer: AccountAddress ) -> BlockMetadata
pub fn id(&self) -> HashValue
pub fn into_inner( self ) -> (u64, u64, Vec<AccountAddress, Global>, AccountAddress)
pub fn timestamp_usec(&self) -> u64
pub fn proposer(&self) -> AccountAddress
Trait Implementations§
§impl Arbitrary for BlockMetadata
impl Arbitrary for BlockMetadata
§type Parameters = SizeRange
type Parameters = SizeRange
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§fn arbitrary_with(
num_validators_range: <BlockMetadata as Arbitrary>::Parameters
) -> <BlockMetadata as Arbitrary>::Strategy
fn arbitrary_with( num_validators_range: <BlockMetadata as Arbitrary>::Parameters ) -> <BlockMetadata as Arbitrary>::Strategy
§type Strategy = BoxedStrategy<BlockMetadata>
type Strategy = BoxedStrategy<BlockMetadata>
The type of
Strategy
used to generate values of type Self
.§impl Clone for BlockMetadata
impl Clone for BlockMetadata
§fn clone(&self) -> BlockMetadata
fn clone(&self) -> BlockMetadata
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for BlockMetadata
impl Debug for BlockMetadata
§impl<'de> Deserialize<'de> for BlockMetadata
impl<'de> Deserialize<'de> for BlockMetadata
§fn deserialize<__D>(
__deserializer: __D
) -> Result<BlockMetadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<BlockMetadata, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl PartialEq<BlockMetadata> for BlockMetadata
impl PartialEq<BlockMetadata> for BlockMetadata
§fn eq(&self, other: &BlockMetadata) -> bool
fn eq(&self, other: &BlockMetadata) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl Serialize for BlockMetadata
impl Serialize for BlockMetadata
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for BlockMetadata
impl StructuralEq for BlockMetadata
impl StructuralPartialEq for BlockMetadata
Auto Trait Implementations§
impl RefUnwindSafe for BlockMetadata
impl Send for BlockMetadata
impl Sync for BlockMetadata
impl Unpin for BlockMetadata
impl UnwindSafe for BlockMetadata
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> TestOnlyHash for Twhere
T: Serialize + ?Sized,
impl<T> TestOnlyHash for Twhere T: Serialize + ?Sized,
§fn test_only_hash(&self) -> HashValue
fn test_only_hash(&self) -> HashValue
Generates a hash used only for tests.