Documentation ¶
Index ¶
- type Watcher
- func (w *Watcher) Add(id raft.ServerID, fsm raft.FSM) raft.FSM
- func (w *Watcher) Commands(id raft.ServerID) uint64
- func (w *Watcher) Electing(id raft.ServerID)
- func (w *Watcher) Restores(id raft.ServerID) uint64
- func (w *Watcher) Snapshots(id raft.ServerID) uint64
- func (w *Watcher) WhenApplied(id raft.ServerID, n uint64) *event.Event
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 ¶
Add an FSM to the watcher. Returns an FSM that wraps the given FSM with instrumentation for firing events.
func (*Watcher) Commands ¶
Commands returns the total number of command logs applied by the FSM of the server with the given ID.
func (*Watcher) Electing ¶
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 ¶
Restores returns the total number of restores performed by the FSM of the server with the given ID.