Documentation ¶
Index ¶
Constants ¶
const ( // DefaultPathName is the default config dir name. DefaultPathName = ".assigner" // 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 = "ASSIGNER_PATH" Version = 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Assignment ¶
type Assignment struct { // FilterIPs, when true, removes any private, loopback, or unspecified IP // addresses from provider and publisher addresses. FilterIPs bool // PoolInterval is how often to poll indexers for status. PollInterval sticfg.Duration // IndexerPool is the set of indexers the pool. IndexerPool []Indexer // Policy configures which peers are allowed and blocked. Policy Policy // PubSubTopic sets the topic name to which to subscribe for ingestion // announcements. PubSubTopic string // PresetReplication is the number of pre-assigned indexers to assign a // publisher to. See Indexer.PresetPeers. Any value < 1 defaults to 1. PresetReplication int // Replication is the number of indexers to assign each publisher to, when // the publisher does not have a preset assignment. A value <= 0 assigns // each publisher to one indexer. Replication int }
Assignment holds addresses of indexers to assign publishers to, policy specifying which peers to allow announce messages from, and related settings.
func NewAssignment ¶
func NewAssignment() Assignment
NewDiscovery returns Discovery with values set to their defaults.
type Config ¶
type Config struct { Version int // config version. Identity sticfg.Identity // peer identity. Assignment Assignment // Indexer assignment settings. Bootstrap sticfg.Bootstrap // Peers to connect to for gossip, Daemon Daemon // daemon settings. Logging Logging // logging configuration., Peering sticfg.Peering // peering service configuration. }
Config is used to load config files.
func (*Config) UpgradeConfig ¶
UpgradeConfig upgrades (or downgrades) the config file to the current version. If the config file is at the current version a backup is still created and the config rewritten with any unconfigured values set to their defaults.
type Daemon ¶
type Daemon struct { // HTTPAddr is the HTTP host multiaddr for receiving direct announce // messages. Set to "none" to disable HTTP hosting. HTTPAddr string // P2PAddr is the libp2p host multiaddr for receiving announce messages. // Set to "none" to disable libp2p hosting. P2PAddr string // NoResourceManager disables the libp2p resource manager when true. NoResourceManager bool }
Daemon stores daemon settings.
type Indexer ¶
type Indexer struct { // AdminURL is the base URL for the indexer's admin interface. AdminURL string // FindURL is the base URL for the indexer's find interface. FindURL string // IngestURL is the base URL for the indexer's ingest interface. IngestURL string // PresetPeers is a list of the peer IDs of pre-assigned publishers. A // publisher is assigned to n of the indexers that has the publisher in // PresetPeers, where n is PresetReplication. PresetPeers []string }
func NewIndexer ¶
func NewIndexer() Indexer
type Logging ¶
type Logging struct { // Level sets the log level for all loggers that do not have a setting in // Loggers. The default value is "info". Level string // Loggers sets log levels for individual loggers. Loggers map[string]string }
Logging configures overall and logger-specific log levels. Level values are case-insensitive and include the following in order of importance: "fatal", "panic", "dpanic", ""error", "warn", "info", "debug"
func NewLogging ¶
func NewLogging() Logging
NewLogging returns Logging with values set to their defaults.
type Policy ¶
type Policy struct { // Allow is either false or true, and determines whether a peer is allowed // (true) or is blocked (false), by default. Allow bool // Except is a list of peer IDs that are exceptions to the Allow policy. // If Allow is true, then all peers are allowed except those listed in // Except. If Allow is false, then no peers are allowed except those listed // in Except. in other words, Allow=true means that Except is a deny-list // and Allow=false means that Except is an allow-list. Except []string }
Policy configures which peers are allowed and which are blocked. Announce messages are accepted from allowed peers and the publisher assigned to an indexer. Announce messagees from blocked peers are ignored.