Documentation ¶
Overview ¶
Package server provides the bootstrapping logic for a node in an arrebato cluster.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoDefaultAdvertiseAddress = errors.New("could not find a default advertise address to use")
ErrNoDefaultAdvertiseAddress is the error returned when the server cannot determine an IP address to advertise to other servers in the cluster.
var ErrReload = errors.New("server has requested to reload from snapshot")
ErrReload is the error given when the server has read a snapshot and must be restarted to restore its state.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // The server version Version string // LogLevel denotes the verbosity of logs. LogLevel int // BindAddress denotes the address the server will bind to for serf, raft & grpc. BindAddress string // AdvertiseAddress denotes the address the server will advertise to other nodes for serf & raft. AdvertiseAddress string // DataPath denotes the on-disk location that raft & message state are stored. DataPath string // Peers contain existing node addresses that should be connected to on start. Peers []string // PruneInterval determines how frequently messages are pruned from topics based on the topic's // retention period. PruneInterval time.Duration Raft RaftConfig Serf SerfConfig GRPC GRPCConfig TLS TLSConfig Metrics MetricConfig }
The Config type contains configuration values for the Server.
type GRPCConfig ¶
type GRPCConfig struct { // The Port to use for gRPC transport. Port int }
The GRPCConfig type describes configuration values for the Server's gRPC endpoints.
type MetricConfig ¶
type MetricConfig struct { // The Port that metrics should be served on via HTTP. Port int }
The MetricConfig type contains configuration values for serving prometheus metrics.
type MetricExporter ¶
The MetricExporter interface describes types that export domain-specific metrics.
type RaftConfig ¶
type RaftConfig struct { // Timeout is the timeout to use for raft communications. Timeout time.Duration // MaxSnapshots is the maximum number of raft snapshots to keep. MaxSnapshots int // NonVoter determines if the server is added to the cluster as a replica that can // never gain leadership. NonVoter bool }
The RaftConfig type describes configuration values for the raft consensus algorithm used to maintain state across the cluster.
type SerfConfig ¶
type SerfConfig struct { // The Port to use for serf transport. Port int // The location of the file whose contents should contain the primary encryption key for // gossip messages. The file contents should be either 16, 24, or 32 bytes to select AES-128, // AES-192, or AES-256. EncryptionKeyFile string }
The SerfConfig type contains configuration values for serf.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
The Server type represents the entire arrebato node and stitches together the serf, raft & grpc configuration.
func (*Server) Apply ¶
Apply unmarshals the contents of the raft.Log, expecting a command.Command that can be handled by a command handler.
func (*Server) Restore ¶
func (svr *Server) Restore(snapshot io.ReadCloser) error
Restore replaces the current state of the applied raft log with the contents of the io.ReadCloser implementation. This is done by initialising the snapshot in a temporary file and triggering the server to restart. The server will detect the restore file, rename it and use it from then on.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
The Snapshot type is used to obtain a copy of the current data store managed by the raft log.
type TLSConfig ¶
type TLSConfig struct { // Location of the TLS certificate file to use for transport credentials. CertFile string // Location of the TLS Key file to use for transport credentials. KeyFile string // The certificate of the CA that signs client certificates. CAFile string }
The TLSConfig type contains configuration values for TLS between the server nodes and clients.