pub struct CodedBlock<B: Block, C: Scheme, H: Hasher> { /* private fields */ }Expand description
An envelope type for an erasure coded Block.
Implementations§
Source§impl<B: Block, C: Scheme, H: Hasher> CodedBlock<B, C, H>
impl<B: Block, C: Scheme, H: Hasher> CodedBlock<B, C, H>
Sourcepub fn new(inner: B, config: CodingConfig, strategy: &impl Strategy) -> Self
pub fn new(inner: B, config: CodingConfig, strategy: &impl Strategy) -> Self
Create a new CodedBlock from a Block and a configuration.
Sourcepub fn new_trusted(inner: B, commitment: Commitment) -> Self
pub fn new_trusted(inner: B, commitment: Commitment) -> Self
Create a new CodedBlock from a Block and trusted Commitment.
Sourcepub const fn config(&self) -> CodingConfig
pub const fn config(&self) -> CodingConfig
Returns the coding configuration for the data committed.
Sourcepub fn shards(&mut self, strategy: &impl Strategy) -> &[C::Shard]
pub fn shards(&mut self, strategy: &impl Strategy) -> &[C::Shard]
Returns a reference to the shards in this coded block.
If the shards have not yet been generated, they will be created via Scheme::encode.
Sourcepub fn shard(&self, index: u16) -> Option<Shard<C, H>>where
B: CertifiableBlock,
pub fn shard(&self, index: u16) -> Option<Shard<C, H>>where
B: CertifiableBlock,
Returns a Shard at the given index, if the index is valid.
Sourcepub fn into_inner(self) -> B
pub fn into_inner(self) -> B
Takes the inner Block.
Trait Implementations§
Source§impl<B: CertifiableBlock, C: Scheme, H: Hasher> Block for CodedBlock<B, C, H>
impl<B: CertifiableBlock, C: Scheme, H: Hasher> Block for CodedBlock<B, C, H>
Source§impl<B: CertifiableBlock, C: Scheme, H: Hasher> CertifiableBlock for CodedBlock<B, C, H>
impl<B: CertifiableBlock, C: Scheme, H: Hasher> CertifiableBlock for CodedBlock<B, C, H>
Source§impl<B: CertifiableBlock, C: Scheme, H: Hasher> Committable for CodedBlock<B, C, H>
impl<B: CertifiableBlock, C: Scheme, H: Hasher> Committable for CodedBlock<B, C, H>
Source§type Commitment = Commitment
type Commitment = Commitment
The type of commitment produced by this object.
Source§fn commitment(&self) -> Self::Commitment
fn commitment(&self) -> Self::Commitment
Source§impl<B: Block, C: Scheme, H: Hasher> Digestible for CodedBlock<B, C, H>
impl<B: Block, C: Scheme, H: Hasher> Digestible for CodedBlock<B, C, H>
Source§impl<B: Block, C: Scheme, H: Hasher> EncodeSize for CodedBlock<B, C, H>
impl<B: Block, C: Scheme, H: Hasher> EncodeSize for CodedBlock<B, C, H>
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Returns the encoded size of this value (in bytes).
Source§fn encode_inline_size(&self) -> usize
fn encode_inline_size(&self) -> usize
Returns the encoded size excluding bytes passed to
BufsMut::push
during Write::write_bufs. Used to size the working buffer for inline
writes. Override alongside Write::write_bufs for types where large
Bytes fields go via push; failing to do so will over-allocate.Source§impl<B: CertifiableBlock + Clone, C: Scheme, H: Hasher> From<CodedBlock<B, C, H>> for StoredCodedBlock<B, C, H>
impl<B: CertifiableBlock + Clone, C: Scheme, H: Hasher> From<CodedBlock<B, C, H>> for StoredCodedBlock<B, C, H>
Source§fn from(block: CodedBlock<B, C, H>) -> Self
fn from(block: CodedBlock<B, C, H>) -> Self
Converts to this type from the input type.
Source§impl<B: Block, C: Scheme, H: Hasher> From<StoredCodedBlock<B, C, H>> for CodedBlock<B, C, H>
Converts a StoredCodedBlock back to a CodedBlock.
impl<B: Block, C: Scheme, H: Hasher> From<StoredCodedBlock<B, C, H>> for CodedBlock<B, C, H>
Converts a StoredCodedBlock back to a CodedBlock.
Source§fn from(stored: StoredCodedBlock<B, C, H>) -> Self
fn from(stored: StoredCodedBlock<B, C, H>) -> Self
Converts to this type from the input type.
Source§impl<B: Block, C: Scheme, H: Hasher> Heightable for CodedBlock<B, C, H>
impl<B: Block, C: Scheme, H: Hasher> Heightable for CodedBlock<B, C, H>
Source§impl<B: Block, C: Scheme, H: Hasher> Read for CodedBlock<B, C, H>
impl<B: Block, C: Scheme, H: Hasher> Read for CodedBlock<B, C, H>
Source§type Cfg = CodedBlockCfg<B>
type Cfg = CodedBlockCfg<B>
The
Cfg type parameter allows passing configuration during the read process. This is
crucial for safely decoding untrusted data, for example, by providing size limits for
collections or strings. Read moreSource§impl<B: Block, C: Scheme, H: Hasher> Write for CodedBlock<B, C, H>
impl<B: Block, C: Scheme, H: Hasher> Write for CodedBlock<B, C, H>
Source§fn write_bufs(&self, buf: &mut impl BufsMut)
fn write_bufs(&self, buf: &mut impl BufsMut)
Writes to a
BufsMut, allowing existing Bytes chunks to be
appended via BufsMut::push instead of written inline. Must encode
to the same format as Write::write. Defaults to Write::write.impl<B: Block + Eq, C: Scheme, H: Hasher> Eq for CodedBlock<B, C, H>
Auto Trait Implementations§
impl<B, C, H> Freeze for CodedBlock<B, C, H>
impl<B, C, H> RefUnwindSafe for CodedBlock<B, C, H>where
<C as Scheme>::Commitment: RefUnwindSafe,
H: RefUnwindSafe,
B: RefUnwindSafe,
<C as Scheme>::Shard: RefUnwindSafe,
impl<B, C, H> Send for CodedBlock<B, C, H>
impl<B, C, H> Sync for CodedBlock<B, C, H>
impl<B, C, H> Unpin for CodedBlock<B, C, H>
impl<B, C, H> UnsafeUnpin for CodedBlock<B, C, H>
impl<B, C, H> UnwindSafe for CodedBlock<B, C, H>where
<C as Scheme>::Commitment: UnwindSafe,
B: RefUnwindSafe,
H: UnwindSafe,
<C as Scheme>::Shard: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Encode for Twhere
T: Write + EncodeSize,
impl<T> Encode for Twhere
T: Write + EncodeSize,
Source§impl<T> EncodeExt for Twhere
T: EncodeSize + Write,
impl<T> EncodeExt for Twhere
T: EncodeSize + Write,
Source§fn encode_with_pool_mut(&self, pool: &BufferPool) -> IoBufMut
fn encode_with_pool_mut(&self, pool: &BufferPool) -> IoBufMut
Source§fn encode_with_pool(&self, pool: &BufferPool) -> IoBufs
fn encode_with_pool(&self, pool: &BufferPool) -> IoBufs
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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