pub struct DataChunk {
pub address: XorName,
pub content: Bytes,
}Expand description
A chunk of data with its content-addressed identifier.
Chunks are the fundamental storage unit in Autonomi. They are:
- Immutable: Content cannot be changed after storage
- Content-addressed: Address = BLAKE3(content)
- Paid: Storage requires EVM payment on Arbitrum
Fields§
§address: XorNameThe content-addressed identifier (BLAKE3 of content).
content: BytesThe raw data content.
Implementations§
Source§impl DataChunk
impl DataChunk
Sourcepub fn new(address: XorName, content: Bytes) -> Self
pub fn new(address: XorName, content: Bytes) -> Self
Create a new data chunk.
Note: This does NOT verify that address == BLAKE3(content).
Use from_content for automatic address computation.
Sourcepub fn from_content(content: Bytes) -> Self
pub fn from_content(content: Bytes) -> Self
Create a chunk from content, computing the address automatically.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DataChunk
impl RefUnwindSafe for DataChunk
impl Send for DataChunk
impl Sync for DataChunk
impl Unpin for DataChunk
impl UnsafeUnpin for DataChunk
impl UnwindSafe for DataChunk
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> 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