raftforwarder

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold builds a dependency.Manifold for running a raftforwarder worker.

func NewTarget

func NewTarget(st *state.State, logFile io.Writer, errorLog Logger) raftlease.NotifyTarget

NewTarget is a shim to construct a raftlease.NotifyTarget for testability.

func NewWorker

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

NewWorker creates and starts a worker that will forward leadership claims from non-raft-leader machines.

Types

type Config

type Config struct {
	Hub                  *pubsub.StructuredHub
	Raft                 RaftApplier
	Logger               Logger
	Topic                string
	Target               raftlease.NotifyTarget
	PrometheusRegisterer prometheus.Registerer
}

Config defines the resources the worker needs to run.

func (Config) Validate

func (config Config) Validate() error

Validate checks that this config can be used.

type Logger

type Logger interface {
	Errorf(string, ...interface{})
	Warningf(string, ...interface{})
	Tracef(string, ...interface{})
}

Logger specifies the interface we use from loggo.Logger.

type ManifoldConfig

type ManifoldConfig struct {
	AgentName      string
	RaftName       string
	StateName      string
	CentralHubName string

	RequestTopic         string
	PrometheusRegisterer prometheus.Registerer
	Logger               Logger
	NewWorker            func(Config) (worker.Worker, error)
	NewTarget            func(*state.State, io.Writer, Logger) raftlease.NotifyTarget
}

ManifoldConfig holds the resources needed to start a raft forwarder worker in a dependency engine.

func (ManifoldConfig) Validate

func (config ManifoldConfig) Validate() error

Validate checks that the config has all the required values.

type RaftApplier

type RaftApplier interface {
	Apply(cmd []byte, timeout time.Duration) raft.ApplyFuture
}

RaftApplier allows applying a command to the raft FSM.

Jump to

Keyboard shortcuts

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