Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Blobs layer for iroh

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

n0-computer/iroh-blobs

 
 

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.

Concepts

  • 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.

Getting started

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

Examples that useiroh-blobs can be found inthis repo.

License

This project is licensed under either of

at your option.

Contribution

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

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp