Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update fullrt docs #768

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions fullrt/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ var logger = logging.Logger("fullrtdht")

// 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 @@ -100,6 +110,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) {
var fullrtcfg config
if err := fullrtcfg.apply(options...); err != nil {
Expand Down Expand Up @@ -216,6 +229,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