Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster interface { discovery.Listener // GetActiveNodes returns all active nodes GetActiveNodes() []*models.ActiveNode // GetShardAssign returns shard assignment by database name, return not exist err if it not exist GetShardAssign(databaseName string) (*models.ShardAssignment, error) // SaveShardAssign saves shard assignment SaveShardAssign(databaseName string, shardAssign *models.ShardAssignment) error // SubmitTask generates coordinator task SubmitTask(kind task.Kind, name string, params []task.ControllerTaskParam) error // GetRepo returns current storage cluster's state repo GetRepo() state.Repository // Close closes cluster controller Close() }
Cluster represents storage cluster controller, 1) discovery active node list in cluster 2) save shard assignment 3) generate coordinator task
type ClusterStateMachine ¶
type ClusterStateMachine interface { discovery.Listener // GetCluster returns cluster controller for maintain the metadata of storage cluster GetCluster(name string) Cluster // GetAllCluster returns all cluster controller GetAllCluster() []Cluster // Close closes state machine, cleanup and close all cluster controller Close() error }
ClusterStateMachine represents storage cluster control when node is master, watches cluster config change event, then create/delete related storage cluster controller.
func NewClusterStateMachine ¶
func NewClusterStateMachine(ctx context.Context, repo state.Repository) (ClusterStateMachine, error)
NewClusterStateMachine create state machine, init cluster controller if exist, watch change event
type TaskExecutor ¶
type TaskExecutor struct {
// contains filtered or unexported fields
}
TaskExecutor represents storage node task executor. NOTICE: need implements task processor and register it.
func NewTaskExecutor ¶
func NewTaskExecutor(ctx context.Context, node *models.Node, repo state.Repository, storageService service.StorageService) *TaskExecutor
NewTaskExecutor creates task executor
func (*TaskExecutor) Run ¶
func (e *TaskExecutor) Run()
Run runs task executor, watches task assign and runs task process based on task kind in background