raftbackstop

package
Version: v0.0.0-...-3d7d6b0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency.Manifold for running a raftbackstop worker.

func NewWorker

func NewWorker(config Config) (worker.Worker, error)

NewWorker returns a worker responsible for recovering the raft cluster when it's been reduced to one server that can't become leader.

Types

type Config

type Config struct {
	Raft     RaftNode
	LogStore raft.LogStore
	Hub      *pubsub.StructuredHub
	Logger   Logger
	LocalID  raft.ServerID
}

Config holds the values needed by the worker.

func (Config) Validate

func (config Config) Validate() error

Validate validates the raft worker configuration.

type Logger

type Logger interface {
	Infof(message string, args ...interface{})
	Debugf(message string, args ...interface{})
	Tracef(message string, args ...interface{})
}

Logger represents the logging methods called.

type ManifoldConfig

type ManifoldConfig struct {
	RaftName       string
	CentralHubName string
	AgentName      string

	Logger    loggo.Logger
	NewWorker func(Config) (worker.Worker, error)
}

ManifoldConfig holds the information necessary to run a worker for maintaining the raft backstop configuration in a dependency.Engine.

type RaftNode

type RaftNode interface {
	State() raft.RaftState
	GetConfiguration() raft.ConfigurationFuture
	BootstrapCluster(configuration raft.Configuration) raft.Future
}

RaftNode captures the part of the *raft.Raft API needed by the backstop worker.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL