Skip to content

host / swarm: move the peerstore out of the swarm #1992

Open
@marten-seemann

Description

@marten-seemann

We should refactor the host and swarm, such that the peerstore is owned by the host, not by the swarm. The swarm shouldn’t know about the peerstore at all. All it needs to do is dial addresses, accept incoming connections and manage existing ones.

This would allow us to get rid of the slightly convoluted dialing process that we have right now. When you want to dial a new peers, now you have to:

  1. Put the new addresses into the peerstore
  2. Ask the swarm to dial these new addresses

As a first step, this can be as easy as replacing the DialPeer(context.Context, peer.ID) error with a DialPeer(context.Context, peer.ID, []ma.Multiaddr) error function.

In a second iteration, we probably want to make it possible to interact more intimately with the dial job:

  • feed newly discovered addresses into an existing job
  • get feedback that an existing job is likely to fail and that it would make sense to start feeding in new addresses (e.g. by starting a DHT lookup for new addresses)

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/daysEstimated to take multiple days, but less than a weekexp/intermediatePrior experience is likely helpfulgood first issueGood issue for new contributorskind/architectureCore architecture of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions