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

add .keys to all feed details you own #104

Merged
merged 1 commit into from
Nov 10, 2022
Merged

add .keys to all feed details you own #104

merged 1 commit into from
Nov 10, 2022

Conversation

staltz
Copy link
Member

@staltz staltz commented Nov 9, 2022

Context

In ssb-box2 we're going to have to traverse "my" metafeed tree, and then match that with other peers' metafeed tree to create DH keys.

Problem

When using default branchStream, it returns any branch in the "forest" (the collection of all trees), and there isn't any way how we can know whether a branch belongs to my tree, or some other peer's tree.

Solution

Add .keys field for all feed details returned by branchStream if I own that feed. If details.keys exists, it means you own the subfeed (well, by definition, because if you have the keys, you can publish to that feed).

In the implementation, this requires loading our seed before querying ssb-db2 for messages that build up the branches lookup data structure. We also load the root metafeed keys in that data structure ASAP, so that whenever we stumble upon a feed, we can check if it's parents details.keys exists, and then hydrate the keys with the seed.

Asking for a review from @arj03, but pinging @mixmix just to be aware of this PR.

@staltz staltz requested a review from arj03 November 9, 2022 14:16
@staltz
Copy link
Member Author

staltz commented Nov 10, 2022

Can haz eyeballs on this?

Copy link
Member

@arj03 arj03 left a comment

Choose a reason for hiding this comment

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

Somehow missed this. Thanks for the ping. The changes looks good. Relatively easy to review.

@staltz staltz merged commit 62a0631 into master Nov 10, 2022
@staltz staltz deleted the own-branches branch November 10, 2022 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants