pub struct Collection { /* private fields */ }
Expand description
A collection of blobs
Note that the format is subject to change.
Implementations§
Source§impl Collection
impl Collection
Sourcepub const HEADER: &'static [u8; 13] = b"CollectionV0."
pub const HEADER: &'static [u8; 13] = b"CollectionV0."
The header for the collection format.
This is the start of the metadata blob.
Sourcepub fn to_blobs(&self) -> impl DoubleEndedIterator<Item = Bytes>
pub fn to_blobs(&self) -> impl DoubleEndedIterator<Item = Bytes>
Convert the collection to an iterator of blobs, with the last being the root blob.
To persist the collection, write all the blobs to storage, and use the hash of the last blob as the collection hash.
Sourcepub async fn read_fsm(
fsm_at_start_root: AtStartRoot,
) -> Result<(EndBlobNext, HashSeq, Collection)>
pub async fn read_fsm( fsm_at_start_root: AtStartRoot, ) -> Result<(EndBlobNext, HashSeq, Collection)>
Read the collection from a get fsm.
Returns the fsm at the start of the first child blob (if any), the links array, and the collection.
Sourcepub async fn read_fsm_all(
fsm_at_start_root: AtStartRoot,
) -> Result<(Collection, BTreeMap<u64, Bytes>, Stats)>
pub async fn read_fsm_all( fsm_at_start_root: AtStartRoot, ) -> Result<(Collection, BTreeMap<u64, Bytes>, Stats)>
Read the collection and all it’s children from a get fsm.
Returns the collection, a map from blob offsets to bytes, and the stats.
Sourcepub async fn load(root: Hash, store: &impl SimpleStore) -> Result<Self>
pub async fn load(root: Hash, store: &impl SimpleStore) -> Result<Self>
Create a new collection from a hash sequence and metadata.
Sourcepub async fn store(self, db: &Store) -> Result<TempTag>
pub async fn store(self, db: &Store) -> Result<TempTag>
Store a collection in a store. returns the root hash of the collection as a TempTag.
Trait Implementations§
Source§impl Clone for Collection
impl Clone for Collection
Source§fn clone(&self) -> Collection
fn clone(&self) -> Collection
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Collection
impl Debug for Collection
Source§impl Default for Collection
impl Default for Collection
Source§fn default() -> Collection
fn default() -> Collection
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Collection
impl<'de> Deserialize<'de> for Collection
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<K, V> Extend<(K, V)> for Collection
impl<K, V> Extend<(K, V)> for Collection
Source§fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<K, V> FromIterator<(K, V)> for Collection
impl<K, V> FromIterator<(K, V)> for Collection
Source§impl Index<usize> for Collection
impl Index<usize> for Collection
Source§impl IntoIterator for Collection
impl IntoIterator for Collection
Source§impl PartialEq for Collection
impl PartialEq for Collection
Source§impl Serialize for Collection
impl Serialize for Collection
impl StructuralPartialEq for Collection
Auto Trait Implementations§
impl Freeze for Collection
impl RefUnwindSafe for Collection
impl Send for Collection
impl Sync for Collection
impl Unpin for Collection
impl UnwindSafe for Collection
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