juju: github.com/juju/juju/worker/raft/raftforwarder Index | Files

package raftforwarder

import "github.com/juju/juju/worker/raft/raftforwarder"


Package Files

manifold.go metrics.go worker.go

func Manifold Uses

func Manifold(config ManifoldConfig) dependency.Manifold

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

func NewTarget Uses

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 Uses

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

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

type Config Uses

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 Uses

func (config Config) Validate() error

Validate checks that this config can be used.

type Logger Uses

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

Logger specifies the interface we use from loggo.Logger.

type ManifoldConfig Uses

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 Uses

func (config ManifoldConfig) Validate() error

Validate checks that the config has all the required values.

type RaftApplier Uses

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

RaftApplier allows applying a command to the raft FSM.

Package raftforwarder imports 17 packages (graph) and is imported by 4 packages. Updated 2020-04-29. Refresh now. Tools for package owners.