fsm

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(tableName, stateMachineDir string, fs vfs.FS, blockCache *pebble.Cache, tableCache *pebble.TableCache, srt SnapshotRecoveryType, af func(applied uint64)) sm.CreateOnDiskStateMachineFunc

Types

type FSM

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

FSM is a statemachine.IOnDiskStateMachine impl.

func (*FSM) Close

func (p *FSM) Close() error

Close closes the KVStateMachine IStateMachine.

func (*FSM) Collect

func (p *FSM) Collect(ch chan<- prometheus.Metric)

func (*FSM) Describe

func (p *FSM) Describe(ch chan<- *prometheus.Desc)

func (*FSM) GetHash

func (p *FSM) GetHash() (uint64, error)

GetHash gets the DB hash for test comparison.

func (*FSM) Lookup

func (p *FSM) Lookup(l interface{}) (interface{}, error)

Lookup locally looks up the data.

func (*FSM) Open

func (p *FSM) Open(_ <-chan struct{}) (uint64, error)

func (*FSM) PrepareSnapshot

func (p *FSM) PrepareSnapshot() (interface{}, error)

PrepareSnapshot prepares the snapshot to be concurrently captured and streamed.

func (*FSM) RecoverFromSnapshot

func (p *FSM) RecoverFromSnapshot(r io.Reader, stopc <-chan struct{}) error

RecoverFromSnapshot recovers the state machine state from snapshot specified by the io.Reader object. The snapshot is recovered into a new DB first and then atomically swapped with the existing DB to complete the recovery.

func (*FSM) SaveSnapshot

func (p *FSM) SaveSnapshot(ctx interface{}, w io.Writer, stopc <-chan struct{}) error

SaveSnapshot saves the state of the object to the provided io.Writer object.

func (*FSM) Sync

func (p *FSM) Sync() error

Sync synchronizes all in-core state of the state machine to permanent storage so the state machine can continue from its latest state after reboot.

func (*FSM) Update

func (p *FSM) Update(updates []sm.Entry) ([]sm.Entry, error)

Update advances the FSM.

type IndexResponse

type IndexResponse struct {
	Index uint64
}

IndexResponse returns local index.

type IteratorRequest added in v0.4.0

type IteratorRequest struct {
	RangeOp *regattapb.RequestOp_Range
}

IteratorRequest returns open pebble.Iterator it is an API consumer responsibility to close it.

type LeaderIndexRequest

type LeaderIndexRequest struct{}

LeaderIndexRequest to read leader index.

type LocalIndexRequest

type LocalIndexRequest struct{}

LocalIndexRequest to read local index.

type PathRequest

type PathRequest struct{}

PathRequest request data disk paths.

type PathResponse

type PathResponse struct {
	Path string
}

PathResponse returns SM data paths.

type SnapshotRecoveryType added in v0.2.0

type SnapshotRecoveryType uint8
const (
	RecoveryTypeSnapshot SnapshotRecoveryType = iota
	RecoveryTypeCheckpoint
)

type SnapshotRequest

type SnapshotRequest struct {
	Writer  io.Writer
	Stopper <-chan struct{}
}

SnapshotRequest to write Command snapshot into provided writer.

type SnapshotResponse

type SnapshotResponse struct {
	Index uint64
}

SnapshotResponse returns local index to which the snapshot was created.

type UpdateResult

type UpdateResult uint64

UpdateResult if operation succeeded or not, both values mean that operation finished, value just indicates with which result. You should always check for err from proposals to detect unfinished or failed operations.

const (
	// ResultFailure failed to apply update.
	ResultFailure UpdateResult = iota
	// ResultSuccess applied update.
	ResultSuccess
)

Jump to

Keyboard shortcuts

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