pub struct SegmentHeader { /* private fields */ }Expand description
A segment header that contains information common to all segments. Used for storage.
Implementations§
Source§impl SegmentHeader
impl SegmentHeader
Sourcepub const fn new(
expected_block_range: SegmentRangeInclusive,
block_range: Option<SegmentRangeInclusive>,
tx_range: Option<SegmentRangeInclusive>,
segment: StaticFileSegment,
) -> Self
pub const fn new( expected_block_range: SegmentRangeInclusive, block_range: Option<SegmentRangeInclusive>, tx_range: Option<SegmentRangeInclusive>, segment: StaticFileSegment, ) -> Self
Returns SegmentHeader.
Sourcepub const fn segment(&self) -> StaticFileSegment
pub const fn segment(&self) -> StaticFileSegment
Returns the static file segment kind.
Sourcepub const fn expected_block_range(&self) -> SegmentRangeInclusive
pub const fn expected_block_range(&self) -> SegmentRangeInclusive
Returns the expected block range.
Sourcepub const fn block_range(&self) -> Option<SegmentRangeInclusive>
pub const fn block_range(&self) -> Option<SegmentRangeInclusive>
Returns the block range.
Sourcepub const fn tx_range(&self) -> Option<SegmentRangeInclusive>
pub const fn tx_range(&self) -> Option<SegmentRangeInclusive>
Returns the transaction range.
Sourcepub const fn changeset_offsets(&self) -> Option<&Vec<ChangesetOffset>>
pub const fn changeset_offsets(&self) -> Option<&Vec<ChangesetOffset>>
Returns the changeset offsets.
Sourcepub const fn expected_block_start(&self) -> BlockNumber
pub const fn expected_block_start(&self) -> BlockNumber
The expected block start of the segment.
Sourcepub const fn expected_block_end(&self) -> BlockNumber
pub const fn expected_block_end(&self) -> BlockNumber
The expected block end of the segment.
Sourcepub fn block_start(&self) -> Option<BlockNumber>
pub fn block_start(&self) -> Option<BlockNumber>
Returns the first block number of the segment.
Sourcepub fn tx_start(&self) -> Option<TxNumber>
pub fn tx_start(&self) -> Option<TxNumber>
Returns the first transaction number of the segment.
Sourcepub fn increment_block(&mut self) -> BlockNumber
pub fn increment_block(&mut self) -> BlockNumber
Increments block end range depending on segment
Sourcepub const fn increment_tx(&mut self)
pub const fn increment_tx(&mut self)
Increments tx end range depending on segment
Sourcepub fn increment_block_changes(&mut self)
pub fn increment_block_changes(&mut self)
Increments the latest block’s number of changes.
Sourcepub const fn set_block_range(
&mut self,
block_start: BlockNumber,
block_end: BlockNumber,
)
pub const fn set_block_range( &mut self, block_start: BlockNumber, block_end: BlockNumber, )
Sets a new block_range.
Sourcepub fn sync_changeset_offsets(&mut self)
pub fn sync_changeset_offsets(&mut self)
Synchronizes changeset offsets with the current block range for account changeset segments.
This should be called after modifying the block range when dealing with changeset segments to ensure the offsets vector matches the block range size.
Sourcepub const fn set_tx_range(&mut self, tx_start: TxNumber, tx_end: TxNumber)
pub const fn set_tx_range(&mut self, tx_start: TxNumber, tx_end: TxNumber)
Sets a new tx_range.
Sourcepub fn start(&self) -> Option<u64>
pub fn start(&self) -> Option<u64>
Returns the row offset which depends on whether the segment is block or transaction based.
Sourcepub fn changeset_offset(&self, block: BlockNumber) -> Option<&ChangesetOffset>
pub fn changeset_offset(&self, block: BlockNumber) -> Option<&ChangesetOffset>
Returns the ChangesetOffset corresponding for the given block, if it’s in the block
range.
If it is not in the block range or the changeset list in the header does not contain a
value for the block, this returns None.
Trait Implementations§
Source§impl Clone for SegmentHeader
impl Clone for SegmentHeader
Source§fn clone(&self) -> SegmentHeader
fn clone(&self) -> SegmentHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SegmentHeader
impl Debug for SegmentHeader
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>,
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
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
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> 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: 96 bytes