fsms

package
v0.0.0-...-ecdf110 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

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

Watcher watches all FSMs of a cluster, firing events at certain moments.

func New

func New(logger hclog.Logger) *Watcher

New create a new FSMs watcher for watching the underlying FSMs.

func (*Watcher) Add

func (w *Watcher) Add(id raft.ServerID, fsm raft.FSM) raft.FSM

Add an FSM to the watcher. Returns an FSM that wraps the given FSM with instrumentation for firing events.

func (*Watcher) Commands

func (w *Watcher) Commands(id raft.ServerID) uint64

Commands returns the total number of command logs applied by the FSM of the server with the given ID.

func (*Watcher) Electing

func (w *Watcher) Electing(id raft.ServerID)

Electing must be called whenever the given server is about to transition to the leader state, and before any new command log is applied.

It resets the internal state of the FSN, such the the commands counter.

func (*Watcher) Restores

func (w *Watcher) Restores(id raft.ServerID) uint64

Restores returns the total number of restores performed by the FSM of the server with the given ID.

func (*Watcher) Snapshots

func (w *Watcher) Snapshots(id raft.ServerID) uint64

Snapshots returns the total number of snapshots performed by the FSM of the server with the given ID.

func (*Watcher) WhenApplied

func (w *Watcher) WhenApplied(id raft.ServerID, n uint64) *event.Event

WhenApplied returns an event that will fire when the n'th command log for the term is applied on the FSM associated with the server with the given ID. It's that such server is currently the leader.

Jump to

Keyboard shortcuts

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