Struct Blob

Source
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

Source

pub fn new(data: Vec<u8>) -> Result<Self, DecdsError>

Creates a new Blob from raw byte data.

This involves:

  1. Calculating the blob’s digest and padding its length to a multiple of ChunkSet::BYTE_LENGTH.
  2. Dividing the data into ChunkSets and erasure-coding them individually.
  3. Building a Merkle tree over the chunksets’ root commitments to create the blob’s root commitment.
  4. Appending blob-level Merkle proofs to each chunk within the chunksets.
§Arguments
  • data - The raw Vec<u8> representing the blob’s content.
§Returns

Returns a Result which is:

  • Ok(Self) containing the newly created Blob if successful.
  • Err(DecdsError::EmptyDataForBlob) if the input data is empty.
  • Other DecdsError types may be returned from underlying ChunkSet::new or MerkleTree::new calls.
Source

pub fn get_blob_header(&self) -> &BlobHeader

Returns a reference to the BlobHeader of this blob.

Source

pub fn get_share( &self, share_id: usize, ) -> Result<Vec<ProofCarryingChunk>, DecdsError>

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 (0 to DECDS_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) if share_id is 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V