fsm

package
v0.0.0-...-435ba0e Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSM

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

FSM implements a finite state machine that is used along with Raft to provide strong consistency. We implement this outside the Server to avoid exposing this outside the package.

func New

func New() *FSM

func (*FSM) Apply

func (c *FSM) Apply(log *raft.Log) interface{}

func (*FSM) Restore

func (c *FSM) Restore(old io.ReadCloser) error

Restore streams in the snapshot and replaces the current state store with a new one based on the snapshot if all goes OK during the restore.

func (*FSM) Snapshot

func (c *FSM) Snapshot() (raft.FSMSnapshot, error)

func (*FSM) State

func (c *FSM) State() *HostMembership

State is used to return a handle to the current state

type HostMember

type HostMember struct {
	Name      string    `json:"name"`
	Desc      string    `json:"description"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type HostMembership

type HostMembership struct {
	Ver     string       `json:"ver"`
	Members []HostMember `json:"members"`
}

func (*HostMembership) Clone

func (h *HostMembership) Clone() *HostMembership

func (*HostMembership) Decode

func (h *HostMembership) Decode(r io.Reader) (*HostMembership, error)

Jump to

Keyboard shortcuts

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