Skip to main content

write_roots

Function write_roots 

Source
pub fn write_roots(
    roots: &[Cid],
    blocks: impl IntoIterator<Item = (Cid, Vec<u8>)>,
) -> Vec<u8> ⓘ
Expand description

Writes a CARv1 stream with however many roots it has, including none.

A file with no roots is a bag of blocks and says so: it declares nothing to start walking from, because the caller asked for particular blocks by name rather than for a structure. That is what com.atproto.sync.getBlocks returns and it is what the reference implementation writes for it, so it is what this writes rather than inventing a root the caller did not ask for.