Struct unixfs_v1::file::adder::FileAdder [−][src]
pub struct FileAdder { /* fields omitted */ }
Expand description
File tree builder. Implements core::default::Default
which tracks the recent defaults.
Custom file tree builder can be created with FileAdder::builder()
and configuring the
chunker and collector.
Current implementation maintains an internal buffer for the block creation and uses a non-customizable hash function to produce Cid version 0 links. Currently does not support inline links.
Implementations
Returns a FileAdderBuilder
for creating a non-default FileAdder.
Returns the likely amount of buffering the file adding will work with best.
When using the size based chunker and input larger than or equal to the hint is push()
’ed
to the chunker, the internal buffer will not be used.
Called to push new file bytes into the tree builder.
Returns the newly created blocks (at most 2) and their respective Cids, and the amount of
input
consumed.
Called after the last FileAdder::push
to finish the tree construction.
Returns a list of Cids and their respective blocks.
Note: the API will hopefully evolve in a direction which will not allocate a new Vec for every block in the near-ish future.