manager

package
v0.0.0-...-d828794 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type INodeManager

type INodeManager interface {
	KeepRegister(ctx context.Context) error
	HasLeader(ctx context.Context) (bool, error)
	IsLeader(ctx context.Context) (bool, error)
	GetNodes(ctx context.Context) ([]string, error)
	SaveLeaderNodes(ctx context.Context, nodes []string) error
	Watch(ctx context.Context) (<-chan []string, error)
}

type IShardManager

type IShardManager interface {
	Reset(ctx context.Context) error
	DeleteTask(ctx context.Context, taskName string) error
	GetRunningShards(ctx context.Context, taskName string) ([]string, error)
	SaveTask(ctx context.Context, taskName string, shardsByNode map[string][]string) error
	GetShardsOnNode(ctx context.Context, taskName, node string) ([]string, error)
	WatchShardChange(ctx context.Context, taskName, node string) (<-chan model.Shards, error)
	WatchForNewTask(ctx context.Context) (<-chan model.TaskNodeShardStore, error)
	DeleteRunningShard(ctx context.Context, taskName, node, shard string) error
	DeleteRunningNode(ctx context.Context, taskName, node string) error
	SetShardRunning(ctx context.Context, taskName, node, shard string) error
}

type ITaskManager

type ITaskManager interface {
	GetAllTasks(ctx context.Context) ([]*model.TaskConfig, error)
	Watch(ctx context.Context) (<-chan []*model.TaskConfig, error)
	WatchTaskConfig(ctx context.Context, taskName string) (<-chan *model.TaskConfig, error)
	Put(ctx context.Context, value *model.TaskConfig) error
}

type NodeManager

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

func NewNodeManager

func NewNodeManager(addr string, client *clientv3.Client) *NodeManager

func (*NodeManager) GetNodes

func (m *NodeManager) GetNodes(ctx context.Context) ([]string, error)

func (*NodeManager) HasLeader

func (m *NodeManager) HasLeader(ctx context.Context) (bool, error)

func (*NodeManager) IsLeader

func (m *NodeManager) IsLeader(ctx context.Context) (bool, error)

func (*NodeManager) KeepRegister

func (m *NodeManager) KeepRegister(ctx context.Context) error

func (*NodeManager) SaveLeaderNodes

func (m *NodeManager) SaveLeaderNodes(ctx context.Context, nodes []string) error

func (*NodeManager) Watch

func (m *NodeManager) Watch(ctx context.Context) (<-chan []string, error)

type ShardManager

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

func NewShardManager

func NewShardManager(addr string, client *clientv3.Client) *ShardManager

func (*ShardManager) DeleteRunningNode

func (s *ShardManager) DeleteRunningNode(ctx context.Context, taskName, node string) error

func (*ShardManager) DeleteRunningShard

func (s *ShardManager) DeleteRunningShard(ctx context.Context, taskName, node, shard string) error

func (*ShardManager) DeleteTask

func (s *ShardManager) DeleteTask(ctx context.Context, taskName string) error

func (*ShardManager) GetRunningShards

func (s *ShardManager) GetRunningShards(ctx context.Context, taskName string) ([]string, error)

func (*ShardManager) GetShardsOnNode

func (s *ShardManager) GetShardsOnNode(ctx context.Context, taskName, node string) ([]string, error)

func (*ShardManager) Reset

func (s *ShardManager) Reset(ctx context.Context) error

func (*ShardManager) SaveTask

func (s *ShardManager) SaveTask(ctx context.Context, taskName string, shardsByNode map[string][]string) error

func (*ShardManager) SetShardRunning

func (s *ShardManager) SetShardRunning(ctx context.Context, taskName, node, shard string) error

func (*ShardManager) WatchForNewTask

func (s *ShardManager) WatchForNewTask(ctx context.Context) (<-chan model.TaskNodeShardStore, error)

func (*ShardManager) WatchShardChange

func (s *ShardManager) WatchShardChange(ctx context.Context, taskName, node string) (<-chan model.Shards, error)

type TaskManager

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

func NewTaskManager

func NewTaskManager(client *clientv3.Client) *TaskManager

func (*TaskManager) GetAllTasks

func (t *TaskManager) GetAllTasks(ctx context.Context) ([]*model.TaskConfig, error)

func (*TaskManager) Put

func (t *TaskManager) Put(ctx context.Context, value *model.TaskConfig) error

func (*TaskManager) Watch

func (t *TaskManager) Watch(ctx context.Context) (<-chan []*model.TaskConfig, error)

func (*TaskManager) WatchTaskConfig

func (t *TaskManager) WatchTaskConfig(ctx context.Context, taskName string) (<-chan *model.TaskConfig, error)

Jump to

Keyboard shortcuts

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