Function filecoin_proofs_api::seal::write_and_preprocess

source ·
pub fn write_and_preprocess<R, W>(
    registered_proof: RegisteredSealProof,
    source: R,
    target: W,
    piece_size: UnpaddedBytesAmount,
) -> Result<(PieceInfo, UnpaddedBytesAmount)>
where R: Read, W: Read + Write + Seek,
Expand description

Writes bytes from source to target, adding bit-padding (“preprocessing”) as needed. Returns a tuple containing the number of bytes written to target and the commitment.

WARNING: This function neither prepends nor appends alignment bytes to the target; it is the caller’s responsibility to ensure properly sized and ordered writes to target such that source-bytes occupy whole subtrees of the final Merkle tree built over target.

§Arguments

  • registered_proof - Selected seal proof for this byte source.
  • source - A readable source of unprocessed piece bytes.
  • target - A writer where we will write the processed piece bytes.
  • piece_size - The number of unpadded user-bytes which can be read from source before EOF.

Returns a tuple containing the number of bytes written to target and the commitment.