pub struct NoCoding<H> { /* private fields */ }Expand description
A trivial scheme which performs no coding at all.
Instead, each shard contains all of the data.
The commitment is simply a hash of that data. This struct is generic over the choice of commonware_cryptography::Hasher.
Trait Implementations§
Source§impl<H: Hasher> Scheme for NoCoding<H>
impl<H: Hasher> Scheme for NoCoding<H>
Source§type Commitment = <H as Hasher>::Digest
type Commitment = <H as Hasher>::Digest
A commitment attesting to the shards of data.
Source§type StrongShard = StrongShard
type StrongShard = StrongShard
A strong shard of data, to be received by a participant.
Source§type WeakShard = WeakShard
type WeakShard = WeakShard
A weak shard shared with other participants, to aid them in reconstruction. Read more
Source§type CheckedShard = ()
type CheckedShard = ()
A shard that has been checked for inclusion in the commitment. Read more
Source§type CheckingData = Vec<u8>
type CheckingData = Vec<u8>
Data which can assist in checking shards.
Source§type Error = Error
type Error = Error
The type of errors that can occur during encoding, weakening, checking, and decoding.
Source§fn encode(
config: &Config,
data: impl Buf,
_strategy: &impl Strategy,
) -> Result<(Self::Commitment, Vec<Self::StrongShard>), Self::Error>
fn encode( config: &Config, data: impl Buf, _strategy: &impl Strategy, ) -> Result<(Self::Commitment, Vec<Self::StrongShard>), Self::Error>
Encode a piece of data, returning a commitment, along with shards, and proofs. Read more
Source§fn weaken(
_config: &Config,
commitment: &Self::Commitment,
_index: u16,
shard: Self::StrongShard,
) -> Result<(Self::CheckingData, Self::CheckedShard, Self::WeakShard), Self::Error>
fn weaken( _config: &Config, commitment: &Self::Commitment, _index: u16, shard: Self::StrongShard, ) -> Result<(Self::CheckingData, Self::CheckedShard, Self::WeakShard), Self::Error>
Take your own shard, check it, and produce a Scheme::WeakShard to forward to others. Read more
Source§fn check(
_config: &Config,
_commitment: &Self::Commitment,
_checking_data: &Self::CheckingData,
_index: u16,
_weak_shard: Self::WeakShard,
) -> Result<Self::CheckedShard, Self::Error>
fn check( _config: &Config, _commitment: &Self::Commitment, _checking_data: &Self::CheckingData, _index: u16, _weak_shard: Self::WeakShard, ) -> Result<Self::CheckedShard, Self::Error>
Check the integrity of a weak shard, producing a checked shard. Read more
Source§fn decode(
_config: &Config,
_commitment: &Self::Commitment,
checking_data: Self::CheckingData,
_shards: &[Self::CheckedShard],
_strategy: &impl Strategy,
) -> Result<Vec<u8>, Self::Error>
fn decode( _config: &Config, _commitment: &Self::Commitment, checking_data: Self::CheckingData, _shards: &[Self::CheckedShard], _strategy: &impl Strategy, ) -> Result<Vec<u8>, Self::Error>
Decode the data from shards received from other participants. Read more
impl<H: Copy> Copy for NoCoding<H>
impl<H: Hasher> ValidatingScheme for NoCoding<H>
Auto Trait Implementations§
impl<H> Freeze for NoCoding<H>
impl<H> RefUnwindSafe for NoCoding<H>where
H: RefUnwindSafe,
impl<H> Send for NoCoding<H>where
H: Send,
impl<H> Sync for NoCoding<H>where
H: Sync,
impl<H> Unpin for NoCoding<H>where
H: Unpin,
impl<H> UnsafeUnpin for NoCoding<H>
impl<H> UnwindSafe for NoCoding<H>where
H: UnwindSafe,
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> 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