libp2p
for K-DHT.
A wrapper API around Goals
- Be able to share files over K-DHT using libp2p between two farmers.
Key ideas
- The idea is to not interact with
libp2p
directly. But, instead to wrap them in an interface/API that is suitable to our needs, let's call this wrapping, theClient
API. - Do not think in terms of
libp2p
, do not structure the code in terms oflibp2p
constructs and concepts. At least, theClient
API, should not follow that pattern. - There should be a
run
method, which will spawn anEventLoop
in the background. - The
Client
API will interact with thisEventLoop
.
Requirements
- Important: We want to start a libp2p node, when we are in farming mode.
- Not so important: We want to start the node on a seperate thread, maybe?
- Not so important: When the farmer starts, it should load the details of the chunks in its plot and announce itself as a
provider
for those chunks. - Important: We want the node to join an overlay network, which means, we basically want it to connect with a few special nodes that are always up and running, called bootnodes.
Implementation Details
Since we have seperated the work into two logical units: the Client
API and the EventLoop
.
Both of them will:
- Be defined using structs
- We will define their behaviour using traits
- They will have seperate enums that define their events