-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move collection to iroh-bytes and add metadata header (#1841)
## Description This changes the collection type a bit to make it more idiomatic rust. E.g. it now implements traits to use it like a... collection, like FromIterator. It also moves collection (back) to iroh-bytes so it can be used from tools like sendme without having to depend on all of iroh. This collection format is intended to be a minimum viable metadata format that we can support for a long time - just a sequence of strings with a string for each blob in the HashSeq. It is useful for tools like sendme and for gateways, so I think this is valuable enough to have as a separate format to e.g. document snapshots. ## Notes & open questions Should this be sequences of blobs? Weirdly, in this case I am OK with a sequence of strings. If somebody wants names to be arbitrary blobs they can always define another metadata format. ## Change checklist - [ ] Self-review. - [ ] Documentation updates if relevant. - [ ] Tests if relevant.
- Loading branch information
Showing
9 changed files
with
173 additions
and
174 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//! Defines data formats for HashSeq. | ||
//! | ||
//! The exact details how to use a HashSeq for specific purposes is up to the | ||
//! user. However, the following approach is used by iroh formats: | ||
//! | ||
//! The first child blob is a metadata blob. It starts with a header, followed | ||
//! by serialized metadata. We mostly use [postcard] for serialization. The | ||
//! metadata either implicitly or explicitly refers to the other blobs in the | ||
//! HashSeq by index. | ||
//! | ||
//! In a very simple case, the metadata just an array of items, where each item | ||
//! is the metadata for the corresponding blob. The metadata array will have | ||
//! n-1 items, where n is the number of blobs in the HashSeq. | ||
//! | ||
//! [postcard]: https://docs.rs/postcard/latest/postcard/ | ||
pub mod collection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.