Thanks for the reply. I’m quite sad its “read the code”.
Going through the code in core/commands for dht.provide reveals little about what to expect from a QueryEvent. At least to me – I’m not a Go pro.
The command itself only forms QueryEvent events for any errors that occur. Otherwise the happy-path QueryEvents are simply re-emitted from whatever machinery drives the DHT internally (I think?). And this one cannot follow from the code since its hidden behind interfaces. There are also no comments or hints to follow.
Or maybe I’m misunderstanding and the response only contains any errors that may have occurred? And for the happy path there is no inner responses?
when sending query to a peer, ID will be the ID of that peer ID
when getting a Value after a lookup, Extra will contain the value.
When getting a PeerResponse (I can only imagine this is querying a peer for other closest peers), the ID is the peer ID of the queried peer, and the Responses array contains the peer IDs (AddrInfos) of those peers.
When a QueryError happens, Extra contains the reason.
When dialing a peer, ID contains the peer ID that you are dialing to.
FinalPeer events are issued in this file to after GetClosestPeer queries, which IDs being those of the peers.
I don’t see AddingPeer events being issued anywhere.
While it is not good excuse for not having better docs, the dht subcommands in go-ipfs are also not the hot-path and mostly there for ipfs developers and advanced users. Hopefully I’m helping you to become one!
so would this be a fair interpretation of the fields:
"Extra": "<string>", // any extra info
"ID": "<peer-id>", // ID of peer queried (i.e. node sending this response)
// List of peers we also "put" the value on?
// Other known peers also providing this value?
// k-Peers closest to the CID to be provided?
// multi-addr of peer[i]
// ID of peer[i]
// Response type; can be error, peer-response, etc.
// Defined inside go-code somewhere :(
Now its also possible for dht.provide to have multiple CIDs in the request. So then I’m really not sure what this would look like for a response.