add .keys to all feed details you own #104
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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. Ifdetails.keys
exists, it means you own the subfeed (well, by definition, because if you have thekeys
, 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 parentsdetails.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.