Crate delivery_blob

Source
Expand description

Library for creating, serializing, and deserializing RFC 0207 delivery blobs. For example, to create a Type 1 delivery blob:

use delivery_blob::{CompressionMode, Type1Blob};
let merkle = "68d131bc271f9c192d4f6dcd8fe61bef90004856da19d0f2f514a7f4098b0737";
let data: Vec<u8> = vec![0xFF; 8192];
let payload: Vec<u8> = Type1Blob::generate(&data, CompressionMode::Attempt);

payload is now a delivery blob which can be written using the delivery path:

use delivery_blob::delivery_blob_path;
use std::fs::OpenOptions;
let path = delivery_blob_path(merkle);
let mut file = OpenOptions::new().write(true).create_new(true).open(&path).unwrap();
file.set_len(payload.len() as u64).unwrap();
file.write_all(&payload).unwrap();

Modules§

  • Implementation of chunked-compression library in Rust. Archives can be created by making a new ChunkedArchive and serializing/writing it. An archive’s header can be verified and seek table decoded using decode_archive.

Structs§

Enums§

Constants§

  • Prefix used for writing delivery blobs. Should be prepended to the Merkle root of the blob.

Functions§

  • Calculate the merkle root digest of the decompressed delivery_blob, delivery blob type is auto detected.
  • Decompress a delivery blob in delivery_blob, delivery blob type is auto detected.
  • Decompress a delivery blob in delivery_blob, and write the decompressed blob to writer, delivery blob type is auto detected.
  • Returns the decompressed size of delivery_blob, delivery blob type is auto detected.
  • Returns the decompressed size of the delivery blob from reader.
  • Obtain the file path to use when writing blob_name as a delivery blob.
  • Generate a delivery blob of the specified delivery_type for data using default parameters.
  • Generate a delivery blob of the specified delivery_type for data using default parameters and write the generated blob to writer.