node

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigSchema = config.Schema{

	"core.https_address": {Validator: validate.Optional(validate.IsListenAddress(true, true, false))},

	"cluster.https_address": {Validator: validate.Optional(validate.IsListenAddress(true, false, false))},

	"core.bgp_address": {Validator: validate.Optional(validate.IsListenAddress(true, true, false))},

	"core.bgp_routerid": {Validator: validate.Optional(validate.IsNetworkAddressV4)},

	"core.debug_address": {Validator: validate.Optional(validate.IsListenAddress(true, true, false))},

	"core.dns_address": {Validator: validate.Optional(validate.IsListenAddress(true, true, false))},

	"core.metrics_address": {Validator: validate.Optional(validate.IsListenAddress(true, true, false))},

	"core.storage_buckets_address": {Validator: validate.Optional(validate.IsListenAddress(true, true, false))},

	"core.syslog_socket": {Validator: validate.Optional(validate.IsBool), Type: config.Bool},

	"storage.backups_volume": {},

	"storage.images_volume": {},
}

ConfigSchema defines available server configuration keys.

Functions

func DetermineRaftNode

func DetermineRaftNode(ctx context.Context, tx *db.NodeTx) (*db.RaftNode, error)

DetermineRaftNode figures out what raft node ID and address we have, if any.

This decision is based on the value of the cluster.https_address config key and on the rows in the raft_nodes table, both stored in the node-level SQLite database.

The following rules are applied:

  • If no cluster.https_address config key is set, this is a non-clustered node and the returned RaftNode will have ID 1 but no address, to signal that the node should setup an in-memory raft cluster where the node itself is the only member and leader.

  • If cluster.https_address config key is set, but there is no row in the raft_nodes table, this is a brand new clustered node that is joining a cluster, and same behavior as the previous case applies.

  • If cluster.https_address config key is set and there is at least one row in the raft_nodes table, then this node is considered a raft node if cluster.https_address matches one of the rows in raft_nodes. In that case, the matching db.RaftNode row is returned, otherwise nil.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config holds member-local configuration values.

func ConfigLoad

func ConfigLoad(ctx context.Context, tx *db.NodeTx) (*Config, error)

ConfigLoad loads a new Config object with the current node-local configuration values fetched from the database. An optional list of config value triggers can be passed, each config key must have at most one trigger.

func (*Config) BGPAddress

func (c *Config) BGPAddress() string

BGPAddress returns the address and port to setup the BGP listener on.

func (*Config) BGPRouterID

func (c *Config) BGPRouterID() string

BGPRouterID returns the address to use as a router ID.

func (*Config) ClusterAddress

func (c *Config) ClusterAddress() string

ClusterAddress returns the address and port this cluster member should use for cluster communication.

func (*Config) DNSAddress

func (c *Config) DNSAddress() string

DNSAddress returns the address and port to setup the DNS listener on.

func (*Config) DebugAddress

func (c *Config) DebugAddress() string

DebugAddress returns the address and port to setup the pprof listener on.

func (*Config) Dump

func (c *Config) Dump() map[string]string

Dump current configuration keys and their values. Keys with values matching their defaults are omitted.

func (*Config) HTTPSAddress

func (c *Config) HTTPSAddress() string

HTTPSAddress returns the address and port this server should expose its // API to, if any.

func (*Config) MetricsAddress

func (c *Config) MetricsAddress() string

MetricsAddress returns the address and port to setup the metrics listener on.

func (*Config) Patch

func (c *Config) Patch(patch map[string]string) (map[string]string, error)

Patch changes only the configuration keys in the given map.

func (*Config) Replace

func (c *Config) Replace(values map[string]string) (map[string]string, error)

Replace the current configuration with the given values.

func (*Config) StorageBackupsVolume

func (c *Config) StorageBackupsVolume() string

StorageBackupsVolume returns the name of the pool/volume to use for storing backup tarballs.

func (*Config) StorageBucketsAddress

func (c *Config) StorageBucketsAddress() string

StorageBucketsAddress returns the address and port to setup the storage buckets listener on.

func (*Config) StorageImagesVolume

func (c *Config) StorageImagesVolume() string

StorageImagesVolume returns the name of the pool/volume to use for storing image tarballs.

func (*Config) SyslogSocket

func (c *Config) SyslogSocket() bool

SyslogSocket returns true if the syslog socket is enabled, otherwise false.

Jump to

Keyboard shortcuts

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