- Notifications
You must be signed in to change notification settings - Fork14
Blobs layer for iroh
License
Apache-2.0, MIT licenses found
Licenses found
n0-computer/iroh-blobs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
NOTE: this version of iroh-blobs is not yet considered production quality. For now, if you need production quality, use iroh-blobs 0.35
This crate provides blob and blob sequence 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 entire sequences of blobs in one request.
The requester opens a QUIC stream to the provider and sends the request. The provider answers with the requested data, encoded asBLAKE3 verified streams, on the same QUIC stream.
This crate is used together withiroh. Connection establishment is left up to the user or higher level APIs.
Blob: a sequence of bytes of arbitrary size, without any metadata.
Link: a 32 byte BLAKE3 hash of a blob.
HashSeq: a blob that contains a sequence of links. Its size is a multiple of 32.
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.
Theiroh-blobs
protocol was designed to be used in conjunction withiroh
.Iroh is a networking library for making direct connections, these connections are what power the data transfers iniroh-blobs
.
Iroh provides aRouter
that takes anEndpoint
and any protocols needed for the application. Similar to a router in webserver library, it runs a loop accepting incoming connections and routes them to the specific protocol handler, based onALPN
.
Here is a basic example of how to set upiroh-blobs
withiroh
:
use iroh::{protocol::Router,Endpoint};use iroh_blobs::{store::Store, net_protocol::Blobs};#[tokio::main]asyncfnmain() -> anyhow::Result<()>{// create an iroh endpoint that includes the standard discovery mechanisms// we've built at number0let endpoint =Endpoint::builder().discovery_n0().bind().await?;// create an in-memory blob store// use `iroh_blobs::net_protocol::Blobs::persistent` to load or create a// persistent blob store from a pathlet blobs =Blobs::memory().build(&endpoint);// turn on the "rpc" feature if you need to create blobs and tags clientslet blobs_client = blobs.client();let tags_client = blobs_client.tags();// build the routerlet router =Router::builder(endpoint).accept(iroh_blobs::ALPN, blobs.clone()).spawn();// do fun stuff with the blobs protocol! router.shutdown().await?;drop(tags_client);Ok(())}
Examples that useiroh-blobs
can be found inthis repo.
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE orhttp://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT orhttp://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submittedfor 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.
About
Blobs layer for iroh
Resources
License
Apache-2.0, MIT licenses found
Licenses found
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.