List Provider Records

Hi! What’s the best way to get a list of the provider records that a node currently stores?

I was looking at https://godoc.org/github.com/libp2p/go-libp2p-kad-dht. Should we read these from datastore instead using Query for all keys with |PREFIX|? https://godoc.org/github.com/ipfs/go-datastore/query#Query

The component that manages persistence of providers is the ProviderManager, in the child providers package. But unfortunately:

  1. IpfsDHT does not expose the ProviderManager as a public field or via a getter.
  2. The ProviderManager does not support enumerating providers.

So as it stands, yeah, the immediate, most obvious way to enumerate provider records we hold is by iterating over the keyspace in the datastore. But that is really a leaky workaround.

For observability purposes, we should allow enumerating provider records via the DHT component itself. I’ve filed an issue:

2 Likes