Documentation ¶
Index ¶
Constants ¶
const ProviderAddrTTL = time.Minute * 30
ProviderAddrTTL is the TTL of an address we've received from a provider. This is also a temporary address, but lasts longer. After this expires, the records we return will require an extra lookup.
const ProvidersKeyPrefix = "/providers/"
ProvidersKeyPrefix is the prefix/namespace for ALL provider record keys stored in the data store.
Variables ¶
var ProvideValidity = time.Hour * 48
ProvideValidity is the default time that a Provider Record should last on DHT This value is also known as Provider Record Expiration Interval.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*ProviderManager) error
Option is a function that sets a provider manager option.
func CleanupInterval ¶
CleanupInterval sets the time between GC runs. Defaults to 1h.
type ProviderManager ¶
type ProviderManager struct {
// contains filtered or unexported fields
}
ProviderManager adds and pulls providers out of the datastore, caching them in between
func NewProviderManager ¶
func NewProviderManager(ctx context.Context, local peer.ID, ps peerstore.Peerstore, dstore ds.Batching, opts ...Option) (*ProviderManager, error)
NewProviderManager constructor
func (*ProviderManager) AddProvider ¶
AddProvider adds a provider
func (*ProviderManager) GetProviders ¶
GetProviders returns the set of providers for the given key. This method _does not_ copy the set. Do not modify it.
func (*ProviderManager) Process ¶
func (pm *ProviderManager) Process() goprocess.Process
Process returns the ProviderManager process