Documentation
¶
Index ¶
Constants ¶
const DefaultPrefix protocol.ID = amino.ProtocolPrefix
DefaultPrefix is the application specific prefix attached to all DHT protocols by default.
Variables ¶
var Defaults = func(o *Config) error { o.Validator = record.NamespacedValidator{} o.Datastore = dssync.MutexWrap(ds.NewMapDatastore()) o.ProtocolPrefix = DefaultPrefix o.EnableProviders = true o.EnableValues = true o.QueryPeerFilter = EmptyQueryFilter o.MsgSenderBuilder = net.NewMessageSenderImpl o.RoutingTable.LatencyTolerance = 10 * time.Second o.RoutingTable.RefreshQueryTimeout = 10 * time.Second o.RoutingTable.RefreshInterval = 10 * time.Minute o.RoutingTable.AutoRefresh = true o.RoutingTable.PeerFilter = EmptyRTFilter o.RoutingTable.PersistInterval = time.Hour o.MaxRecordAge = amino.DefaultMaxRecordAge o.ValueGCInterval = amino.DefaultValueGCInterval o.BucketSize = amino.DefaultBucketSize o.Concurrency = amino.DefaultConcurrency o.Resiliency = amino.DefaultResiliency o.LookupCheckConcurrency = 256 o.OptimisticProvideJobsPoolSize = 60 return nil }
Defaults are the default DHT options. This option will be automatically prepended to any options you pass to the DHT constructor.
Functions ¶
Types ¶
type BootstrapOrderOpt ¶ added in v0.43.0
type BootstrapOrderOpt int
BootstrapOrderOpt selects which peers the DHT dials first when its routing table is empty.
type Config ¶
type Config struct {
Datastore ds.Batching
Validator record.Validator
ValidatorChanged bool // if true implies that the validator has been changed and that Defaults should not be used
Mode ModeOpt
ProtocolPrefix protocol.ID
V1ProtocolOverride protocol.ID
BucketSize int
Concurrency int
Resiliency int
MaxRecordAge time.Duration
ValueGCInterval time.Duration
EnableProviders bool
EnableValues bool
ProviderManagerOpts []records.Option
// ValueDatastore and ProviderDatastore optionally give the value store and
// the provider store their own physical datastore. When nil, each falls back
// to Datastore. Record keys are namespaced by a per-record-type prefix, so a
// shared Datastore stays collision-free.
ValueDatastore ds.Batching
ProviderDatastore ds.Batching
QueryPeerFilter QueryFilterFunc
LookupCheckConcurrency int
MsgSenderBuilder func(h host.Host, protos []protocol.ID) pb.MessageSenderWithDisconnect
RoutingTable struct {
RefreshQueryTimeout time.Duration
RefreshInterval time.Duration
AutoRefresh bool
LatencyTolerance time.Duration
CheckInterval time.Duration
PeerFilter RouteTableFilterFunc
DiversityFilter peerdiversity.PeerIPGroupFilter
// PersistInterval is how often the routing table is saved to the
// Datastore; zero disables saving and seeding from saved peers.
PersistInterval time.Duration
}
BootstrapPeers func() []peer.AddrInfo
BootstrapOrder BootstrapOrderOpt
AddressFilter func([]ma.Multiaddr) []ma.Multiaddr
OnRequestHook func(ctx context.Context, s network.Stream, req *pb.Message)
// test specific Config options
DisableFixLowPeers bool
TestAddressUpdateProcessing bool
EnableOptimisticProvide bool
OptimisticProvideJobsPoolSize int
}
Config is a structure containing all the options that can be used when constructing a DHT.
func (*Config) ApplyFallbacks ¶
ApplyFallbacks sets default values that could not be applied during config creation since they are dependent on other configuration parameters (e.g. optA is by default 2x optB) and/or on the Host
func (*Config) ProviderDS ¶ added in v0.42.0
ProviderDS returns the datastore backing the provider store: the ProviderDatastore override when set, else the shared Datastore.
type QueryFilterFunc ¶
QueryFilterFunc is a filter applied when considering peers to dial when querying
type QuorumOptionKey ¶
type QuorumOptionKey struct{}