pub struct DynamicBlockIndex { /* private fields */ }Expand description
ere block index with a dynamic per-block component count.
Unlike era1’s single-offset-per-block index, an ere block can carry a variable number of
components, so the index stores component_count offsets for every block.
Format: starting-number | indexes | indexes | ... | component-count | count
where each indexes group holds the offsets for one block:
header-index | body-index | receipts-index? | difficulty-index? | proof-index?
component-count is 2-5 depending on which optional components are present. Offsets are i64
(they point backward to earlier entries); their little-endian bytes match the spec’s uint64.
See also https://github.com/eth-clients/e2store-format-specs/blob/main/formats/ere.md#specification
Implementations§
Source§impl DynamicBlockIndex
impl DynamicBlockIndex
Sourcepub const fn new(
starting_number: BlockNumber,
component_count: u64,
offsets: Vec<i64>,
) -> Self
pub const fn new( starting_number: BlockNumber, component_count: u64, offsets: Vec<i64>, ) -> Self
Create a new DynamicBlockIndex.
offsets must be block-major with exactly component_count entries per block; the encoded
block count is derived as offsets.len() / component_count.
Sourcepub const fn starting_number(&self) -> u64
pub const fn starting_number(&self) -> u64
Get the starting block number
Sourcepub const fn component_count(&self) -> u64
pub const fn component_count(&self) -> u64
Get the number of index components stored per block
Sourcepub const fn block_count(&self) -> usize
pub const fn block_count(&self) -> usize
Get the number of blocks covered by this index
Sourcepub fn offsets_for_block(&self, block_number: BlockNumber) -> Option<&[i64]>
pub fn offsets_for_block(&self, block_number: BlockNumber) -> Option<&[i64]>
Get the component_count offsets for a specific block number.
Returns a slice ordered as
[header, body, (receipts)?, (difficulty)?, (proof)?], or None when the block is outside
the range covered by this index.
Trait Implementations§
Source§impl Clone for DynamicBlockIndex
impl Clone for DynamicBlockIndex
Source§fn clone(&self) -> DynamicBlockIndex
fn clone(&self) -> DynamicBlockIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DynamicBlockIndex
impl Debug for DynamicBlockIndex
impl Eq for DynamicBlockIndex
Source§impl PartialEq for DynamicBlockIndex
impl PartialEq for DynamicBlockIndex
Source§fn eq(&self, other: &DynamicBlockIndex) -> bool
fn eq(&self, other: &DynamicBlockIndex) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DynamicBlockIndex
Auto Trait Implementations§
impl Freeze for DynamicBlockIndex
impl RefUnwindSafe for DynamicBlockIndex
impl Send for DynamicBlockIndex
impl Sync for DynamicBlockIndex
impl Unpin for DynamicBlockIndex
impl UnsafeUnpin for DynamicBlockIndex
impl UnwindSafe for DynamicBlockIndex
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes