pub enum StaticFileSegment {
Headers,
Transactions,
Receipts,
}
Expand description
Segment of the data that can be moved to static files.
Variants§
Headers
Static File segment responsible for the CanonicalHeaders
, Headers
,
HeaderTerminalDifficulties
tables.
Transactions
Static File segment responsible for the Transactions
table.
Receipts
Static File segment responsible for the Receipts
table.
Implementations§
Source§impl StaticFileSegment
impl StaticFileSegment
Sourcepub const fn config(&self) -> SegmentConfig
pub const fn config(&self) -> SegmentConfig
Returns the default configuration of the segment.
Sourcepub fn filename(&self, block_range: &SegmentRangeInclusive) -> String
pub fn filename(&self, block_range: &SegmentRangeInclusive) -> String
Returns the default file name for the provided segment and range.
Sourcepub fn filename_with_configuration(
&self,
compression: Compression,
block_range: &SegmentRangeInclusive,
) -> String
pub fn filename_with_configuration( &self, compression: Compression, block_range: &SegmentRangeInclusive, ) -> String
Returns file name for the provided segment and range, alongside filters, compression.
Sourcepub fn parse_filename(name: &str) -> Option<(Self, SegmentRangeInclusive)>
pub fn parse_filename(name: &str) -> Option<(Self, SegmentRangeInclusive)>
Parses a filename into a StaticFileSegment
and its expected block range.
The filename is expected to follow the format:
“static_file
{segment}{block_start
}_{block_end
}”. This function checks
for the correct prefix (“static_file
”), and then parses the segment and the inclusive
ranges for blocks. It ensures that the start of each range is less than or equal to the
end.
§Returns
Some((segment, block_range))
if parsing is successful and all conditions are met.None
if any condition fails, such as an incorrect prefix, parsing error, or invalid range.
§Note
This function is tightly coupled with the naming convention defined in Self::filename
.
Any changes in the filename format in filename
should be reflected here.
Sourcepub const fn is_headers(&self) -> bool
pub const fn is_headers(&self) -> bool
Returns true
if the segment is StaticFileSegment::Headers
.
Sourcepub const fn is_receipts(&self) -> bool
pub const fn is_receipts(&self) -> bool
Returns true
if the segment is StaticFileSegment::Receipts
.
Sourcepub const fn is_tx_based(&self) -> bool
pub const fn is_tx_based(&self) -> bool
Returns true
if the segment is StaticFileSegment::Receipts
or
StaticFileSegment::Transactions
.
Trait Implementations§
Source§impl AsRef<str> for StaticFileSegment
impl AsRef<str> for StaticFileSegment
Source§impl Clone for StaticFileSegment
impl Clone for StaticFileSegment
Source§fn clone(&self) -> StaticFileSegment
fn clone(&self) -> StaticFileSegment
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StaticFileSegment
impl Debug for StaticFileSegment
Source§impl<'de> Deserialize<'de> for StaticFileSegment
impl<'de> Deserialize<'de> for StaticFileSegment
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>,
Source§impl Display for StaticFileSegment
impl Display for StaticFileSegment
Source§impl FromStr for StaticFileSegment
impl FromStr for StaticFileSegment
Source§impl Hash for StaticFileSegment
impl Hash for StaticFileSegment
Source§impl IntoEnumIterator for StaticFileSegment
impl IntoEnumIterator for StaticFileSegment
Source§impl Ord for StaticFileSegment
impl Ord for StaticFileSegment
Source§fn cmp(&self, other: &StaticFileSegment) -> Ordering
fn cmp(&self, other: &StaticFileSegment) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for StaticFileSegment
impl PartialEq for StaticFileSegment
Source§impl PartialOrd for StaticFileSegment
impl PartialOrd for StaticFileSegment
Source§impl Serialize for StaticFileSegment
impl Serialize for StaticFileSegment
Source§impl TryFrom<&str> for StaticFileSegment
impl TryFrom<&str> for StaticFileSegment
Source§impl ValueEnum for StaticFileSegment
impl ValueEnum for StaticFileSegment
impl Copy for StaticFileSegment
impl Eq for StaticFileSegment
impl StructuralPartialEq for StaticFileSegment
Auto Trait Implementations§
impl Freeze for StaticFileSegment
impl RefUnwindSafe for StaticFileSegment
impl Send for StaticFileSegment
impl Sync for StaticFileSegment
impl Unpin for StaticFileSegment
impl UnwindSafe for StaticFileSegment
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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: 1 byte
Size for each variant:
Headers
: 0 bytesTransactions
: 0 bytesReceipts
: 0 bytes