Skip to content

Commit

Permalink
docs: update fullrt docs (#768)
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Michel <[email protected]>
  • Loading branch information
aschmahmann and guillaumemichel authored Feb 5, 2025
1 parent bef5f16 commit 87c65fa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions fullrt/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ const rtRefreshLimitsMsg = `Accelerated DHT client was unable to fully refresh i

// FullRT is an experimental DHT client that is under development. Expect breaking changes to occur in this client
// until it stabilizes.
//
// Running FullRT by itself (i.e. without a companion IpfsDHT) will run into some issues. The most critical is that
// running a FullRT node will not currently keep you connected to the k closest peers which means that your peer's
// addresses may not be discoverable in the DHT. Additionally, FullRT is only a DHT client and not a server which means it does not contribute capacity to the network.
// If you want to run a server you should also run an IpfsDHT instance in server mode.
//
// FullRT has a Ready function that indicates the routing table has been refreshed recently. It is currently within the
// discretion of the application as to how much they care about whether the routing table is ready.
// One approach taken to "readiness" is to not insist on it for ad-hoc operations but to insist on it for larger bulk
// operations.
type FullRT struct {
ctx context.Context
cancel context.CancelFunc
Expand Down Expand Up @@ -112,6 +122,9 @@ type FullRT struct {
// until it stabilizes.
//
// Not all of the standard DHT options are supported in this DHT.
//
// DHT options passed in should be suitable for your network (e.g. protocol prefix, validators, bucket size, and
// bootstrap peers).
func NewFullRT(h host.Host, protocolPrefix protocol.ID, options ...Option) (*FullRT, error) {
fullrtcfg := config{
crawlInterval: time.Hour,
Expand Down Expand Up @@ -268,6 +281,9 @@ func (dht *FullRT) Stat() map[string]peer.ID {
return newMap
}

// Ready indicates that the routing table has been refreshed recently. It is recommended to be used for operations where
// it is important for the operation to be particularly accurate (e.g. bulk publishing where you do not want to
// republish for as long as you can).
func (dht *FullRT) Ready() bool {
dht.rtLk.RLock()
lastCrawlTime := dht.lastCrawlTime
Expand Down

0 comments on commit 87c65fa

Please sign in to comment.