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

WIP: Persisting/seeding a routing table #315

Closed
wants to merge 2 commits into from
Closed

WIP: Persisting/seeding a routing table #315

wants to merge 2 commits into from

Conversation

raulk
Copy link
Member

@raulk raulk commented Apr 8, 2019

Finally got a few spare cycles to push a sketch of what I had in mind for the snapshot/seeding functionality, mostly to drive alignment.

The solution needs to be modular to enable us to:

  • fetch candidates from any source: a datastore, mDNS, an XMPP/IRC room, a Twitter account, DNS TXT records, a file somewhere, etc.
  • decide which candidates we want to seed; we can pick candidates randomly, or we can choose based on latency, geographical location (e.g. to favour proximity), etc.

This proposes two interfaces:

  • Snapshotter: responsible for loading and storing snapshots. I've included an implementation that uses a Datastore.
  • Seeder: responsible for seeding a routing table from a set of candidates recovered from a snapshot + fallback peers.

It introduces a configuration option, and also proposes an integration point for this inside dht.go.

We should be able to call this logic whenever, not just at start. That will enable us to recover from disasters.

Note that this is heavy WIP, and I probably won't have the bandwidth to take this over the finish line. But I wanted to push these ideas out there. I really think the solution needs to be modular.

@ghost ghost assigned raulk Apr 8, 2019
@ghost ghost added the status/in-progress In progress label Apr 8, 2019
@raulk raulk requested review from anacrolix and removed request for anacrolix April 8, 2019 13:54
@raulk
Copy link
Member Author

raulk commented Apr 15, 2019

@anacrolix @jhiesey I'll continue working to solidify this unless you have feedback or concerns about the abstractions being introduced. If so please shout ASAP.

@anacrolix
Copy link
Contributor

@raulk What issues are you targetting with this?

@raulk
Copy link
Member Author

raulk commented Apr 16, 2019

@anacrolix See explanation in description for rationale. If you mean GitHub issues, see conversations in:

#254
#295

@anacrolix
Copy link
Contributor

I don't think this needs to be so complex. A callback that generates peers on demand in the config, and methods to take a snapshot of the routing table, and restore a routing table are more than enough. See #254 (comment).

@raulk
Copy link
Member Author

raulk commented Apr 17, 2019

This design provides both elements, and it does so via pluggable strategies instead of hardcoding behaviours. The composability principle is key in libp2p (we are fans of modularity in libp2p). That said, providing sensible fallbacks is reasonable. Any specific feedback on the design?

See #254 (comment) for reference.

@anacrolix
Copy link
Contributor

I've commented on the respective issues.

@raulk
Copy link
Member Author

raulk commented Jul 23, 2019

@aarshkshah1992 – as per #345 (comment), would you mind commenting on this issue so GitHub will let me assign it to you?

@aarshkshah1992
Copy link
Contributor

Self referential comment

@aarshkshah1992
Copy link
Contributor

@raulk I think I can start looking into this now. Please can you assign it to me ?

@raulk
Copy link
Member Author

raulk commented Oct 12, 2019

This one is landing in #383 -- which takes this WIP PR and makes it mergeable! \o/

@raulk raulk closed this Oct 12, 2019
@raulk raulk changed the title Persisting/seeding a routing table WIP: Persisting/seeding a routing table Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants