Struct noosphere_core::data::BodyChunkIpld
source · pub struct BodyChunkIpld {
pub bytes: Vec<u8>,
pub next: Option<Cid>,
}Expand description
A body chunk is a simplified flexible byte layout used for linking chunks of bytes. This is necessary to support cases when body contents byte size exceeds the IPFS block size (~1MB). This may be replaced with a more sophisticated layout structure in the future.
Fields§
§bytes: Vec<u8>A chunk of bytes
next: Option<Cid>An optional pointer to the next chunk of bytes, if there are any remaining
Implementations§
source§impl BodyChunkIpld
impl BodyChunkIpld
sourcepub async fn store_bytes<S: BlockStore>(
bytes: &[u8],
store: &mut S
) -> Result<Cid>
pub async fn store_bytes<S: BlockStore>( bytes: &[u8], store: &mut S ) -> Result<Cid>
Chunk and encode a slice of bytes as linked BodyChunkIpld, storing the chunks in storage and returning the Cid of the head of the list.
sourcepub async fn load_all_bytes<S: BlockStore>(&self, store: &S) -> Result<Vec<u8>>
pub async fn load_all_bytes<S: BlockStore>(&self, store: &S) -> Result<Vec<u8>>
Fold all bytes in the BodyChunkIpld chain into a single buffer and return it
Trait Implementations§
source§impl Clone for BodyChunkIpld
impl Clone for BodyChunkIpld
source§fn clone(&self) -> BodyChunkIpld
fn clone(&self) -> BodyChunkIpld
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for BodyChunkIpld
impl Debug for BodyChunkIpld
source§impl<'de> Deserialize<'de> for BodyChunkIpld
impl<'de> Deserialize<'de> for BodyChunkIpld
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for BodyChunkIpld
impl PartialEq for BodyChunkIpld
source§fn eq(&self, other: &BodyChunkIpld) -> bool
fn eq(&self, other: &BodyChunkIpld) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serialize for BodyChunkIpld
impl Serialize for BodyChunkIpld
source§impl TryBundle for BodyChunkIpld
impl TryBundle for BodyChunkIpld
fn extend_bundle_with_cid<'life0, 'life1, 'life2, 'async_trait, S>( cid: &'life0 Cid, bundle: &'life1 mut Bundle, store: &'life2 S ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where S: 'async_trait + BlockStore, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
fn extend_bundle<'life0, 'life1, 'life2, 'async_trait, S>( &'life0 self, bundle: &'life1 mut Bundle, _store: &'life2 S ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where S: 'async_trait + BlockStore, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
fn bundle<'life0, 'life1, 'async_trait, S>( &'life0 self, store: &'life1 S ) -> Pin<Box<dyn Future<Output = Result<Bundle>> + Send + 'async_trait>>where S: 'async_trait + BlockStore, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
fn bundle_with_cid<'life0, 'life1, 'async_trait, S>( cid: &'life0 Cid, store: &'life1 S ) -> Pin<Box<dyn Future<Output = Result<Bundle>> + Send + 'async_trait>>where S: 'async_trait + BlockStore, Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
impl Eq for BodyChunkIpld
impl StructuralEq for BodyChunkIpld
impl StructuralPartialEq for BodyChunkIpld
Auto Trait Implementations§
impl RefUnwindSafe for BodyChunkIpld
impl Send for BodyChunkIpld
impl Sync for BodyChunkIpld
impl Unpin for BodyChunkIpld
impl UnwindSafe for BodyChunkIpld
Blanket Implementations§
source§impl<T> Base64Encode for Twhere
T: DagJson,
impl<T> Base64Encode for Twhere T: DagJson,
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> DagJson for Twhere
T: Serialize + DeserializeOwned,
impl<T> DagJson for Twhere T: Serialize + DeserializeOwned,
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.