pub struct Blob { /* private fields */ }Expand description
Represents a complete, erasure-coded blob of data, consisting of a BlobHeader and a collection of ChunkSets,
each of which are holding 16 erasure-coded proof-of-inclusion carrying chunks.
Implementations§
Source§impl Blob
impl Blob
Sourcepub fn new(data: Vec<u8>) -> Result<Self, DecdsError>
pub fn new(data: Vec<u8>) -> Result<Self, DecdsError>
Creates a new Blob from raw byte data.
This involves:
- Calculating the blob’s digest and padding its length to a multiple of
ChunkSet::BYTE_LENGTH. - Dividing the data into
ChunkSets and erasure-coding them individually. - Building a Merkle tree over the chunksets’ root commitments to create the blob’s root commitment.
- Appending blob-level Merkle proofs to each chunk within the chunksets.
§Arguments
data- The rawVec<u8>representing the blob’s content.
§Returns
Returns a Result which is:
Ok(Self)containing the newly createdBlobif successful.Err(DecdsError::EmptyDataForBlob)if the inputdatais empty.- Other
DecdsErrortypes may be returned from underlyingChunkSet::neworMerkleTree::newcalls.
Sourcepub fn get_blob_header(&self) -> &BlobHeader
pub fn get_blob_header(&self) -> &BlobHeader
Returns a reference to the BlobHeader of this blob.
Retrieves a specific “share” (a collection of erasure-coded chunks, one from each chunkset)
based on the share_id.
Each share represents a vertical slice through the blob’s chunksets.
§Arguments
share_id- The ID of the share to retrieve (0toDECDS_NUM_ERASURE_CODED_SHARES - 1).
§Returns
Returns a Result which is:
Ok(Vec<ProofCarryingChunk>)containing a vector of proof-carrying chunks for the requested share.Err(DecdsError::InvalidErasureCodedShareId)ifshare_idis out of bounds.
Auto Trait Implementations§
impl Freeze for Blob
impl RefUnwindSafe for Blob
impl Send for Blob
impl Sync for Blob
impl Unpin for Blob
impl UnwindSafe for Blob
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> 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