opts

package
v0.7.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2022 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Defaults = func(o *Options) error {
	o.Datastore = dssync.MutexWrap(ds.NewMapDatastore())
	tcpAddr, _ := multiaddr.NewMultiaddr("/ip4/0.0.0.0/tcp/0")
	quicAddr, _ := multiaddr.NewMultiaddr("/ip4/0.0.0.0/udp/0/quic")
	o.Addrs = []multiaddr.Multiaddr{tcpAddr, quicAddr}
	o.ProtocolPrefix = dht.DefaultPrefix
	o.BucketSize = 20
	o.BootstrapPeers = dht.DefaultBootstrapPeers
	return nil
}

Defaults are the default Hydra Head options. This option will be automatically prepended to any options you pass to the Hydra Head constructor.

Functions

This section is empty.

Types

type Option

type Option func(*Options) error

Option is the Hydra Head option type.

func Addrs

func Addrs(addrs []multiaddr.Multiaddr) Option

Addrs configures the swarm addresses for this Hydra node. The default value is /ip4/0.0.0.0/tcp/0 and /ip4/0.0.0.0/udp/0/quic.

func BootstrapPeers

func BootstrapPeers(addrs []multiaddr.Multiaddr) Option

BootstrapPeers configures the set of bootstrap peers that should be randomly selected from. The default value is `dht.DefaultBootstrapPeers`.

func BucketSize

func BucketSize(bucketSize int) Option

BucketSize configures the bucket size of the routing table. The default value is 20.

func Datastore

func Datastore(ds ds.Batching) Option

Datastore configures the Hydra Head to use the specified datastore. Defaults to an in-memory (temporary) map.

func DelegateHTTPClient

func DelegateHTTPClient(c *http.Client) Option

func DisableProvCounts

func DisableProvCounts() Option

DisableProvCounts disables counting the number of providers in the provider store.

func DisableProvGC

func DisableProvGC() Option

DisableProvGC disables garbage collections of provider records from the shared datastore. The default value is false.

func DisableProviders

func DisableProviders() Option

DisableProviders disables storing and retrieving provider records. The default value is false.

func DisableValues

func DisableValues() Option

DisableValues disables storing and retrieving value records (including public keys). The default value is false.

func EnableRelay

func EnableRelay() Option

EnableRelay configures whether this node acts as a relay node. The default value is false.

func ID

func ID(id crypto.PrivKey) Option

ID for the head

func Limiter

func Limiter(l chan struct{}) Option

Limiter configures ???. The default value is nil.

func Peerstore

func Peerstore(ps peerstore.Peerstore) Option

Peerstore configures the Hydra Head to use the specified peerstore. Defaults to an in-memory (temporary) map.

func ProtocolPrefix

func ProtocolPrefix(pfx protocol.ID) Option

ProtocolPrefix configures the application specific prefix attached to all DHT protocols by default. The default value is "/ipfs".

func ProviderStoreBuilder

func ProviderStoreBuilder(builder func(Options, host.Host) (providers.ProviderStore, error)) Option

func ProvidersFinder

func ProvidersFinder(f hproviders.ProvidersFinder) Option

func ReframeAddr

func ReframeAddr(addr string) Option

ReframeAddr configures the Hydra Head to delegate routing also to this storetheindex addr. Defaults to empty string which indicates no delegation.

func RoutingTable

func RoutingTable(rt *kbucket.RoutingTable) Option

RoutingTable configures the Hydra Head to use the specified routing table. Defaults to the routing table provided by IpfsDHT.

type Options

type Options struct {
	Datastore            ds.Batching
	Peerstore            peerstore.Peerstore
	ProviderStoreBuilder ProviderStoreBuilderFunc
	ReframeAddr          string
	DelegateHTTPClient   *http.Client
	RoutingTable         *kbucket.RoutingTable
	EnableRelay          bool
	Addrs                []multiaddr.Multiaddr
	ProtocolPrefix       protocol.ID
	BucketSize           int
	Limiter              chan struct{}
	BootstrapPeers       []multiaddr.Multiaddr
	ID                   crypto.PrivKey
	DisableProvGC        bool
	DisableProvCounts    bool
	DisableProviders     bool
	DisableValues        bool
	ProvidersFinder      hproviders.ProvidersFinder
}

Options are Hydra Head options

func (*Options) Apply

func (o *Options) Apply(opts ...Option) error

Apply applies the given options to this Option.

type ProviderStoreBuilderFunc

type ProviderStoreBuilderFunc func(opts Options, host host.Host) (providers.ProviderStore, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL