pub enum PruneMode {
Full,
Distance(u64),
Before(BlockNumber),
}
Expand description
Prune mode.
Variants§
Full
Prune all blocks.
Distance(u64)
Prune blocks before the head-N
block number. In other words, keep last N + 1 blocks.
Before(BlockNumber)
Prune blocks before the specified block number. The specified block number is not pruned.
Implementations§
Source§impl PruneMode
impl PruneMode
Sourcepub const fn bitflag_encoded_bytes() -> usize
pub const fn bitflag_encoded_bytes() -> usize
Used bytes by [PruneModeFlags
]
Sourcepub const fn bitflag_unused_bits() -> usize
pub const fn bitflag_unused_bits() -> usize
Unused bits for new fields by [PruneModeFlags
]
Source§impl PruneMode
impl PruneMode
Sourcepub const fn before_inclusive(block_number: BlockNumber) -> Self
pub const fn before_inclusive(block_number: BlockNumber) -> Self
Prune blocks up to the specified block number. The specified block number is also pruned.
This acts as PruneMode::Before(block_number + 1)
.
Sourcepub fn prune_target_block(
&self,
tip: BlockNumber,
segment: PruneSegment,
purpose: PrunePurpose,
) -> Result<Option<(BlockNumber, Self)>, PruneSegmentError>
pub fn prune_target_block( &self, tip: BlockNumber, segment: PruneSegment, purpose: PrunePurpose, ) -> Result<Option<(BlockNumber, Self)>, PruneSegmentError>
Returns block up to which variant pruning needs to be done, inclusive, according to the provided tip.
Sourcepub const fn should_prune(&self, block: BlockNumber, tip: BlockNumber) -> bool
pub const fn should_prune(&self, block: BlockNumber, tip: BlockNumber) -> bool
Check if target block should be pruned according to the provided prune mode and tip.
Sourcepub const fn is_full(&self) -> bool
pub const fn is_full(&self) -> bool
Returns true if the prune mode is PruneMode::Full
.
Sourcepub const fn is_distance(&self) -> bool
pub const fn is_distance(&self) -> bool
Returns true if the prune mode is PruneMode::Distance
.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for PruneMode
impl<'arbitrary> Arbitrary<'arbitrary> for PruneMode
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self
from the entirety of the given
unstructured data. Read moreSource§impl Compact for PruneMode
impl Compact for PruneMode
Source§fn to_compact<B>(&self, buf: &mut B) -> usize
fn to_compact<B>(&self, buf: &mut B) -> usize
Source§fn from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
fn from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
buf
with its internal cursor
advanced (eg..advance(len)
). Read more§fn specialized_to_compact<B>(&self, buf: &mut B) -> usize
fn specialized_to_compact<B>(&self, buf: &mut B) -> usize
§fn specialized_from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
fn specialized_from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
Source§impl<'de> Deserialize<'de> for PruneMode
impl<'de> Deserialize<'de> for PruneMode
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>,
impl Copy for PruneMode
impl Eq for PruneMode
impl StructuralPartialEq for PruneMode
Auto Trait Implementations§
impl Freeze for PruneMode
impl RefUnwindSafe for PruneMode
impl Send for PruneMode
impl Sync for PruneMode
impl Unpin for PruneMode
impl UnwindSafe for PruneMode
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>
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: 16 bytes
Size for each variant:
Full
: 0 bytesDistance
: 8 bytesBefore
: 8 bytes