Module stream

Module stream 

Source
Expand description

Utilities to support producing streams of blocks, as well as converting streams of blocks to and from CARv1-encoded byte streams

Structs§

BlockLedger
A utility to help with tracking the relationship of blocks and references within a series of blocks.

Functions§

from_car_stream
Takes a Bytes stream and interprets it as a CARv1, returning a stream of (Cid, Vec<u8>) blocks.
memo_body_stream
Stream all the blocks required to read the sphere at a given version (making no assumptions of what historical data may already be available to the reader).
memo_history_stream
Stream all the blocks required to reconstruct the history of a sphere since a given point in time (or else the beginning of the history).
put_block_stream
Helper to put blocks from a Stream into any implementor of BlockStore
record_stream_orphans
Wraps a block stream (any stream yielding Result<(Cid, Vec<u8>)>), and records “orphan” blocks to a providede target buffer.
to_car_stream
Takes a list of roots and a stream of blocks (pairs of Cid and corresponding Vec), and produces an async byte stream that yields a valid CARv1
walk_versioned_map_changes_and
Given a VersionedMap and BlockStore, visit the VersionedMap’s changelog; then, invoke the provided callback with each entry associated with an ‘add’ operation in the changelog
walk_versioned_map_elements
Given a VersionedMap, visit its changelog and all of its underlying entries
walk_versioned_map_elements_and
Given a VersionedMap and BlockStore, visit the VersionedMap’s changelog and all of its underlying entries, invoking a callback for each entry