Documentation
¶
Index ¶
- Constants
- Variables
- func Filename(configRoot string) (string, error)
- func Marshal(value interface{}) ([]byte, error)
- func Path(configRoot, configFile string) (string, error)
- func PathRoot() (string, error)
- type AdminServer
- type Bootstrap
- type Config
- type Datastore
- type Duration
- type Identity
- type Ingest
- type ProviderServer
Constants ¶
const ( // DefaultPathName is the default config dir name. DefaultPathName = ".index-provider" // DefaultPathRoot is the path to the default config dir location. DefaultPathRoot = "~/" + DefaultPathName // DefaultConfigFile is the filename of the configuration file. DefaultConfigFile = "config" // EnvDir is the environment variable used to change the path root. EnvDir = "PROVIDER_PATH" )
Variables ¶
var ( ErrInitialized = errors.New("configuration file already exists") ErrNotInitialized = errors.New("not initialized") )
var ErrInvalidPeerAddr = errors.New("invalid peer address")
ErrInvalidPeerAddr signals an address is not a valid peer address.
Functions ¶
func Filename ¶
Filename returns the configuration file path given a configuration root directory. If the configuration root directory is empty, use the default.
Types ¶
type AdminServer ¶
type AdminServer struct {
// Admin is the admin API listen address
ListenMultiaddr string
ReadTimeout Duration
WriteTimeout Duration
}
func NewAdminServer ¶
func NewAdminServer() AdminServer
NewAdminServer instantiates a new AdminServer config with default values.
func (*AdminServer) ListenNetAddr ¶
func (as *AdminServer) ListenNetAddr() (string, error)
type Bootstrap ¶
type Bootstrap struct {
// Peers is the local nodes's bootstrap peer addresses
Peers []string
// MinimumPeers governs whether to bootstrap more connections. If the node
// has less open connections than this number, it will open connections to
// the bootstrap nodes. Set to 0 to disable bootstrapping.
MinimumPeers int
}
func NewBootstrap ¶
func NewBootstrap() Bootstrap
NewBootstrap instantiates a new Bootstrap config with default values.
type Config ¶
type Config struct {
Identity Identity
Datastore Datastore
Ingest Ingest
ProviderServer ProviderServer
AdminServer AdminServer
Bootstrap Bootstrap
}
Config is used to load config files.
func InitWithIdentity ¶
type Datastore ¶
type Datastore struct {
// Type is the type of datastore
Type string
// Dir is the directory within the config root where the datastore is kept
Dir string
}
Datastore tracks the configuration of the datastore.
func NewDatastore ¶
func NewDatastore() Datastore
NewDatastore instantiates a new Datastore config with default values.
type Duration ¶
Duration wraps time.Duration to provide json serialization and deserialization.
NOTE: the zero value encodes to an empty string.
func (Duration) MarshalText ¶
func (*Duration) UnmarshalText ¶
type Identity ¶
Identity tracks the configuration of the local node's identity.
func CreateIdentity ¶
CreateIdentity initializes a new identity.
type Ingest ¶
type Ingest struct {
// LinkCacheSize is the maximum number of links that cash can store before LRU eviction. If a
// single linked list has more links than the cache can hold, the cache is
// resized to be able to hold all links.
LinkCacheSize int
// LinkedChunkSize is the number of hashes in each chunk of ingestion
// linked list.
LinkedChunkSize int
// PubSubTopic used to advertise ingestion announcements.
PubSubTopic string
// PurgeLinkCache tells whether to purge the link cache on daemon startup.
PurgeLinkCache bool
}
Ingest tracks the configuration related to the ingestion protocol
type ProviderServer ¶
type ProviderServer struct {
// ListenMultiaddr is the multiaddr string for the node's listen address
ListenMultiaddr string
// RetrievalMultiaddrs are the addresses to advertise for data retrieval.
// Defaults to the provider's libp2p host listen addresses.
RetrievalMultiaddrs []string
}
func NewProviderServer ¶
func NewProviderServer() ProviderServer
NewProviderServer instantiates a new ProviderServer config with default values.