Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iroh-resolver): create a balanced tree dag #198

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

ramfox
Copy link
Contributor

@ramfox ramfox commented Aug 19, 2022

When adding content to iroh, create a balanced tree.

Our balanced tree implementation takes a stream of
chunks (BytesMut) and returns a stream of Bytes
of the encoded nodes of the dag, and their associated Cids.
(Cid, Bytes)

The implementation emits the node as soon as it has
been created.

All the leaves of the tree are encoded as unixfs Raw
nodes. All the stems & the root of the tree are encoded
as unixfs File nodes.

We've put effort into having our nodes be as similar to
kubo as possible, but we have intentionally differed in
a few ways:

  • all of our "stem" nodes have name: None. In kubo, the
    parents of leaf nodes have the go equivalent of
    name: Some("".to_string()).
  • the tsize of our links is the cumulative size of
    the encoded tree associated with that link. The definition
    of tsize seems to be unfixed, and can mean different things
    depending on the implementation.

@ramfox ramfox added this to the DeltaChat milestone Aug 19, 2022
@ramfox ramfox self-assigned this Aug 19, 2022
@ramfox ramfox force-pushed the ramfox/balanced_tree branch 2 times, most recently from ac101cd to d949b40 Compare August 23, 2022 05:01
@ramfox ramfox marked this pull request as ready for review August 23, 2022 05:02
@ramfox ramfox force-pushed the ramfox/balanced_tree branch 2 times, most recently from ae09aa0 to 660034a Compare August 23, 2022 05:49
@ramfox
Copy link
Contributor Author

ramfox commented Aug 23, 2022

tests failing because: "We cannot run this job using the selected resource class. Please check your configuration and try again."?

@Arqu
Copy link
Collaborator

Arqu commented Aug 23, 2022

tests failing because: "We cannot run this job using the selected resource class. Please check your configuration and try again."?

Ignore mac tests for now, I have to figure it out seems like some permission issue with the runners.

dignifiedquire
dignifiedquire previously approved these changes Aug 31, 2022
@ramfox ramfox changed the title feat: balanced tree for DAG creation feat(iroh-resolver): create a balanced tree dag Aug 31, 2022
When adding content to iroh, create a balanced tree.

Our balanced tree implementation takes a stream of
chunks (`BytesMut`) and returns a stream of Bytes
of the encoded nodes of the dag, and their associated Cids.
`(Cid, Bytes)`

The implementation emits the node as soon as it has
been created.

All the leaves of the tree are encoded as unixfs `Raw`
nodes. All the stems & the root of the tree are encoded
as unixfs `File` nodes.

We've put effort into having our nodes be as similar to
kubo as possible, but we have intentionally differed in
a few ways:
- all of our "stem" nodes have `name: None`. In kubo, the
parents of leaf nodes have the go equivalent of
`name: Some("".to_string())`.
- the `tsize` of our links is the cumulative size of
the encoded tree associated with that link. The definition
of `tsize` seems to be unfixed, and can mean different things
depending on the implementation.
Copy link
Collaborator

@Arqu Arqu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A-OK!

@dignifiedquire dignifiedquire merged commit 3285d1f into n0-computer:main Aug 31, 2022
@ramfox ramfox deleted the ramfox/balanced_tree branch August 31, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants