pub enum SegmentHeader {
V0 {
segment_index: SegmentIndex,
segment_commitment: SegmentCommitment,
prev_segment_header_hash: Blake3Hash,
last_archived_block: LastArchivedBlock,
},
}
Expand description
Segment header for a specific segment.
Each segment will have corresponding SegmentHeader
included as the first item in the next
segment. Each SegmentHeader
includes hash of the previous one and all together form a chain of
segment headers that is used for quick and efficient verification that some Piece
corresponds to the actual archival history of the blockchain.
Variants§
V0
V0 of the segment header data structure
Fields
§
segment_index: SegmentIndex
Segment index
§
segment_commitment: SegmentCommitment
Root of commitments of all records in a segment.
§
prev_segment_header_hash: Blake3Hash
Hash of the segment header of the previous segment
§
last_archived_block: LastArchivedBlock
Last archived block
Implementations§
source§impl SegmentHeader
impl SegmentHeader
sourcepub fn hash(&self) -> Blake3Hash
pub fn hash(&self) -> Blake3Hash
Hash of the whole segment header
sourcepub fn segment_index(&self) -> SegmentIndex
pub fn segment_index(&self) -> SegmentIndex
Segment index
sourcepub fn segment_commitment(&self) -> SegmentCommitment
pub fn segment_commitment(&self) -> SegmentCommitment
Segment commitment of the records in a segment.
sourcepub fn prev_segment_header_hash(&self) -> Blake3Hash
pub fn prev_segment_header_hash(&self) -> Blake3Hash
Hash of the segment header of the previous segment
sourcepub fn last_archived_block(&self) -> LastArchivedBlock
pub fn last_archived_block(&self) -> LastArchivedBlock
Last archived block
Trait Implementations§
source§impl Clone for SegmentHeader
impl Clone for SegmentHeader
source§fn clone(&self) -> SegmentHeader
fn clone(&self) -> SegmentHeader
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 moresource§impl Debug for SegmentHeader
impl Debug for SegmentHeader
source§impl Decode for SegmentHeader
impl Decode for SegmentHeader
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
Attempt to skip the encoded value from input. Read more
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
source§impl<'de> Deserialize<'de> for SegmentHeader
impl<'de> Deserialize<'de> for SegmentHeader
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Encode for SegmentHeader
impl Encode for SegmentHeader
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl Hash for SegmentHeader
impl Hash for SegmentHeader
source§impl PartialEq for SegmentHeader
impl PartialEq for SegmentHeader
source§impl Serialize for SegmentHeader
impl Serialize for SegmentHeader
source§impl TypeInfo for SegmentHeader
impl TypeInfo for SegmentHeader
impl Copy for SegmentHeader
impl EncodeLike for SegmentHeader
impl Eq for SegmentHeader
impl StructuralPartialEq for SegmentHeader
Auto Trait Implementations§
impl Freeze for SegmentHeader
impl RefUnwindSafe for SegmentHeader
impl Send for SegmentHeader
impl Sync for SegmentHeader
impl Unpin for SegmentHeader
impl UnwindSafe for SegmentHeader
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere
T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Decode
Self
and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
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>
Converts
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>
Converts
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§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere
T: Codec,
§fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
Return an encoding of
Self
prepended by given slice.