12 releases (breaking)

0.14.0 Apr 15, 2024
0.13.0 Mar 25, 2024
0.12.0 Dec 20, 2023
0.11.0 Nov 17, 2023
0.5.0 Jul 18, 2023

#612 in Algorithms

Download history 12/week @ 2024-01-05 18/week @ 2024-01-12 35/week @ 2024-01-19 343/week @ 2024-01-26 355/week @ 2024-02-02 249/week @ 2024-02-09 370/week @ 2024-02-16 388/week @ 2024-02-23 412/week @ 2024-03-01 356/week @ 2024-03-08 201/week @ 2024-03-15 488/week @ 2024-03-22 566/week @ 2024-03-29 563/week @ 2024-04-05 811/week @ 2024-04-12 271/week @ 2024-04-19

2,277 downloads per month
Used in 4 crates (3 directly)

MIT/Apache

1MB
20K SLoC

iroh-bytes

This crate provides blob and collection transfer support for iroh. It implements a simple request-response protocol based on blake3 verified streaming.

A request describes data in terms of blake3 hashes and byte ranges. It is possible to request blobs or ranges of blobs, as well as collections.

The requester opens a quic stream to the provider and sends the request. The provider answers with the requested data, encoded as blake3 verified streams, on the same quic stream.

This crate is usually used together with iroh-net, but can also be used with normal quinn connections. Connection establishment is left up to the user or a higher level APIs such as the iroh CLI.

Concepts

  • Blob: a sequence of bytes of arbitrary size, without any metadata.

  • Link: a 32 byte blake3 hash of a blob.

  • Collection: any blob that contains links. The simplest collection is just an array of 32 byte blake3 hashes.

  • Provider: The side that provides data and answers requests. Providers wait for incoming requests from Requests.

  • Requester: The side that asks for data. It is initiating requests to one or many providers.

Examples

Examples that use iroh-bytes can be found in the iroh crate. the iroh crate publishes iroh_bytes as iroh::bytes.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~12–54MB
~868K SLoC