storage

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StateMachinePaths = make(map[string]models.StateMachineInfo)

StateMachinePaths represents the paths which storage state machine need watch.

Functions

This section is empty.

Types

type StateMachineFactory

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

StateMachineFactory represents storage state machine maintainer.

func NewStateMachineFactory

func NewStateMachineFactory(ctx context.Context,
	discoveryFactory discovery.Factory,
	stateMgr StateManager,
) *StateMachineFactory

NewStateMachineFactory creates a StateMachineFactory instance.

func (*StateMachineFactory) Start

func (f *StateMachineFactory) Start() (err error)

Start starts all storage's related state machines.

func (*StateMachineFactory) Stop

func (f *StateMachineFactory) Stop()

Stop stops all storage's related state machines.

type StateManager

type StateManager interface {
	discovery.StateMachineEventHandle

	// GetLiveNode returns storage live node by node id, return false if not exist.
	GetLiveNode(nodeID models.NodeID) (models.StatefulNode, bool)
	// WatchNodeStateChangeEvent registers node state change event handle.
	WatchNodeStateChangeEvent(nodeID models.NodeID, fn func(state models.NodeStateType))
	// GetLiveNodes returns the current live nodes.
	GetLiveNodes() []models.StatefulNode
	// GetDatabaseAssignments returns the current database assignments.
	GetDatabaseAssignments() []*models.DatabaseAssignment
}

StateManager represents storage state manager, maintains storage node in memory.

func NewStateManager

func NewStateManager(
	ctx context.Context,
	current *models.StatefulNode,
	engine tsdb.Engine,
) StateManager

NewStateManager creates a StateManager instance.

Jump to

Keyboard shortcuts

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