Struct sp_core::ChangesTrieConfiguration
source · [−]Expand description
Substrate changes trie configuration.
Fields
digest_interval: u32
Interval (in blocks) at which level1-digests are created. Digests are not created when this is less or equal to 1.
digest_levels: u32
Maximal number of digest levels in hierarchy. 0 means that digests are not
created at all (even level1 digests). 1 means only level1-digests are created.
2 means that every digest_interval^2 there will be a level2-digest, and so on.
Please ensure that maximum digest interval (i.e. digest_interval^digest_levels)
is within u32
limits. Otherwise you’ll never see digests covering such intervals
&& maximal digests interval will be truncated to the last interval that fits
u32
limits.
Implementations
sourceimpl ChangesTrieConfiguration
impl ChangesTrieConfiguration
sourcepub fn new(digest_interval: u32, digest_levels: u32) -> Self
pub fn new(digest_interval: u32, digest_levels: u32) -> Self
Create new configuration given digest interval and levels.
sourcepub fn is_digest_build_enabled(&self) -> bool
pub fn is_digest_build_enabled(&self) -> bool
Is digest build enabled?
sourcepub fn is_digest_build_required_at_block<Number>(
&self,
zero: Number,
block: Number
) -> bool where
Number: From<u32> + PartialEq + Rem<Output = Number> + Sub<Output = Number> + PartialOrd + Zero,
pub fn is_digest_build_required_at_block<Number>(
&self,
zero: Number,
block: Number
) -> bool where
Number: From<u32> + PartialEq + Rem<Output = Number> + Sub<Output = Number> + PartialOrd + Zero,
Do we need to build digest at given block?
sourcepub fn max_digest_interval(&self) -> u32
pub fn max_digest_interval(&self) -> u32
Returns max digest interval. One if digests are not created at all.
sourcepub fn prev_max_level_digest_block<Number>(
&self,
zero: Number,
block: Number
) -> Option<Number> where
Number: Clone + From<u32> + PartialOrd + PartialEq + Add<Output = Number> + Sub<Output = Number> + Div<Output = Number> + Mul<Output = Number> + Zero,
pub fn prev_max_level_digest_block<Number>(
&self,
zero: Number,
block: Number
) -> Option<Number> where
Number: Clone + From<u32> + PartialOrd + PartialEq + Add<Output = Number> + Sub<Output = Number> + Div<Output = Number> + Mul<Output = Number> + Zero,
Returns max level digest block number that has been created at block <= passed block number.
Returns None if digests are not created at all.
sourcepub fn next_max_level_digest_range<Number>(
&self,
zero: Number,
block: Number
) -> Option<(Number, Number)> where
Number: Clone + From<u32> + PartialOrd + PartialEq + Add<Output = Number> + Sub<Output = Number> + Div<Output = Number> + Mul<Output = Number>,
pub fn next_max_level_digest_range<Number>(
&self,
zero: Number,
block: Number
) -> Option<(Number, Number)> where
Number: Clone + From<u32> + PartialOrd + PartialEq + Add<Output = Number> + Sub<Output = Number> + Div<Output = Number> + Mul<Output = Number>,
Returns max level digest blocks range (inclusive) which includes passed block.
Returns None if digests are not created at all. It will return the first max-level digest if block is <= zero.
sourcepub fn digest_level_at_block<Number>(
&self,
zero: Number,
block: Number
) -> Option<(u32, u32, u32)> where
Number: Clone + From<u32> + PartialEq + Rem<Output = Number> + Sub<Output = Number> + PartialOrd + Zero,
pub fn digest_level_at_block<Number>(
&self,
zero: Number,
block: Number
) -> Option<(u32, u32, u32)> where
Number: Clone + From<u32> + PartialEq + Rem<Output = Number> + Sub<Output = Number> + PartialOrd + Zero,
Returns Some if digest must be built at given block number. The tuple is: ( digest level digest interval (in blocks) step between blocks we’re interested in when digest is built )
Trait Implementations
sourceimpl Clone for ChangesTrieConfiguration
impl Clone for ChangesTrieConfiguration
sourcefn clone(&self) -> ChangesTrieConfiguration
fn clone(&self) -> ChangesTrieConfiguration
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ChangesTrieConfiguration
impl Debug for ChangesTrieConfiguration
sourceimpl Decode for ChangesTrieConfiguration
impl Decode for ChangesTrieConfiguration
sourcefn 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.
sourcefn 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
sourcefn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
sourceimpl Default for ChangesTrieConfiguration
impl Default for ChangesTrieConfiguration
sourcefn default() -> ChangesTrieConfiguration
fn default() -> ChangesTrieConfiguration
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for ChangesTrieConfiguration
impl<'de> Deserialize<'de> for ChangesTrieConfiguration
sourcefn 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
sourceimpl Encode for ChangesTrieConfiguration
impl Encode for ChangesTrieConfiguration
sourcefn 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.
sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
sourcefn encode(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn encode(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Convert self to an owned vector.
sourcefn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
sourcefn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
sourceimpl MallocSizeOf for ChangesTrieConfiguration
impl MallocSizeOf for ChangesTrieConfiguration
sourcefn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
If T::size_of
is a constant, consider implementing constant_size
as well. Read more
sourcefn constant_size() -> Option<usize>
fn constant_size() -> Option<usize>
Used to optimize MallocSizeOf
implementation for collections
like Vec
and HashMap
to avoid iterating over them unnecessarily.
The Self: Sized
bound is for object safety. Read more
sourceimpl PartialEq<ChangesTrieConfiguration> for ChangesTrieConfiguration
impl PartialEq<ChangesTrieConfiguration> for ChangesTrieConfiguration
sourcefn eq(&self, other: &ChangesTrieConfiguration) -> bool
fn eq(&self, other: &ChangesTrieConfiguration) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ChangesTrieConfiguration) -> bool
fn ne(&self, other: &ChangesTrieConfiguration) -> bool
This method tests for !=
.
sourceimpl Serialize for ChangesTrieConfiguration
impl Serialize for ChangesTrieConfiguration
impl EncodeLike<ChangesTrieConfiguration> for ChangesTrieConfiguration
impl Eq for ChangesTrieConfiguration
impl StructuralEq for ChangesTrieConfiguration
impl StructuralPartialEq for ChangesTrieConfiguration
Auto Trait Implementations
impl RefUnwindSafe for ChangesTrieConfiguration
impl Send for ChangesTrieConfiguration
impl Sync for ChangesTrieConfiguration
impl Unpin for ChangesTrieConfiguration
impl UnwindSafe for ChangesTrieConfiguration
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> DecodeLimit for T where
T: Decode,
impl<T> DecodeLimit for T where
T: Decode,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
sourceimpl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
impl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
sourcefn malloc_size_of(&self) -> usize
fn malloc_size_of(&self) -> usize
Method to launch a heapsize measurement with a fresh state. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcefn unchecked_into(self) -> T
fn unchecked_into(self) -> T
The counterpart to unchecked_from
.