fsm

package
v1.16.109 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandsSummaries = []prometheus.SummaryDefinition{
	{
		Name: []string{"fsm", "register"},
		Help: "Measures the time it takes to apply a catalog register operation to the FSM.",
	},
	{
		Name: []string{"fsm", "deregister"},
		Help: "Measures the time it takes to apply a catalog deregister operation to the FSM.",
	},
	{
		Name: []string{"fsm", "kvs"},
		Help: "Measures the time it takes to apply the given KV operation to the FSM.",
	},
	{
		Name: []string{"fsm", "session"},
		Help: "Measures the time it takes to apply the given session operation to the FSM.",
	},
	{
		Name: []string{"fsm", "acl"},
		Help: "Measures the time it takes to apply the given ACL operation to the FSM.",
	},
	{
		Name: []string{"fsm", "tombstone"},
		Help: "Measures the time it takes to apply the given tombstone operation to the FSM.",
	},
	{
		Name: []string{"fsm", "coordinate", "batch-update"},
		Help: "Measures the time it takes to apply the given batch coordinate update to the FSM.",
	},
	{
		Name: []string{"fsm", "prepared-query"},
		Help: "Measures the time it takes to apply the given prepared query update operation to the FSM.",
	},
	{
		Name: []string{"fsm", "txn"},
		Help: "Measures the time it takes to apply the given transaction update to the FSM.",
	},
	{
		Name: []string{"fsm", "autopilot"},
		Help: "Measures the time it takes to apply the given autopilot update to the FSM.",
	},
	{
		Name: []string{"consul", "fsm", "intention"},
		Help: "Deprecated - use fsm_intention instead",
	},
	{
		Name: []string{"fsm", "intention"},
		Help: "Measures the time it takes to apply an intention operation to the FSM.",
	},
	{
		Name: []string{"consul", "fsm", "ca"},
		Help: "Deprecated - use fsm_ca instead",
	},
	{
		Name: []string{"fsm", "ca"},
		Help: "Measures the time it takes to apply CA configuration operations to the FSM.",
	},
	{
		Name: []string{"fsm", "ca", "leaf"},
		Help: "Measures the time it takes to apply an operation while signing a leaf certificate.",
	},
	{
		Name: []string{"fsm", "acl", "token"},
		Help: "Measures the time it takes to apply an ACL token operation to the FSM.",
	},
	{
		Name: []string{"fsm", "acl", "policy"},
		Help: "Measures the time it takes to apply an ACL policy operation to the FSM.",
	},
	{
		Name: []string{"fsm", "acl", "bindingrule"},
		Help: "Measures the time it takes to apply an ACL binding rule operation to the FSM.",
	},
	{
		Name: []string{"fsm", "acl", "authmethod"},
		Help: "Measures the time it takes to apply an ACL authmethod operation to the FSM.",
	},
	{
		Name: []string{"fsm", "system_metadata"},
		Help: "Measures the time it takes to apply a system metadata operation to the FSM.",
	},
	{
		Name: []string{"fsm", "peering"},
		Help: "Measures the time it takes to apply a peering operation to the FSM.",
	},
}
View Source
var SnapshotSummaries = []prometheus.SummaryDefinition{
	{
		Name: []string{"fsm", "persist"},
		Help: "Measures the time it takes to persist the FSM to a raft snapshot.",
	},
}

Functions

func ApplyConnectCAOperationFromRequest added in v1.16.100

func ApplyConnectCAOperationFromRequest(state *state.Store, req *structs.CARequest, index uint64) interface{}

func ReadSnapshot added in v1.16.100

func ReadSnapshot(r io.Reader, handler func(header *SnapshotHeader, msg structs.MessageType, dec *codec.Decoder) error) error

ReadSnapshot decodes each message type and utilizes the handler function to process each message type individually

Types

type Deps added in v1.16.100

type Deps struct {
	// Logger used to emit log messages
	Logger hclog.Logger
	// NewStateStore returns a state.Store which the FSM will use to make changes
	// to the state.
	// NewStateStore will be called once when the FSM is created and again any
	// time Restore() is called.
	NewStateStore func() *state.Store

	Publisher *stream.EventPublisher

	// StorageBackend is the storage backend used by the resource service, it
	// manages its own state and has methods for handling Raft logs, snapshotting,
	// and restoring snapshots.
	StorageBackend StorageBackend
}

Deps are dependencies used to construct the FSM.

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 deprecated

func New(gc *state.TombstoneGC, logger hclog.Logger) (*FSM, error)

New is used to construct a new FSM with a blank state.

Deprecated: use NewFromDeps.

func NewFromDeps added in v1.16.100

func NewFromDeps(deps Deps) *FSM

NewFromDeps creates a new FSM from its dependencies.

func (*FSM) Apply

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

func (*FSM) ChunkingFSM added in v1.16.100

func (c *FSM) ChunkingFSM() raft.FSM

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() *state.Store

State is used to return a handle to the current state

type SnapshotHeader added in v1.16.100

type SnapshotHeader struct {
	// LastIndex is the last index that affects the data.
	// This is used when we do the restore for watchers.
	LastIndex uint64
}

SnapshotHeader is the first entry in our snapshot

type StorageBackend added in v1.16.100

type StorageBackend interface {
	Apply(buf []byte, idx uint64) any
	Snapshot() (*raftstorage.Snapshot, error)
	Restore() (*raftstorage.Restoration, error)
}

StorageBackend contains the methods on the Raft resource storage backend that are used by the FSM. See the internal/storage/raft package docs for more info.

var NullStorageBackend StorageBackend = nullStorageBackend{}

NullStorageBackend can be used as the StorageBackend dependency in tests that won't exercize resource storage or snapshotting.

Jump to

Keyboard shortcuts

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