Documentation ¶
Index ¶
- type INodeManager
- type IShardManager
- type ITaskManager
- type NodeManager
- func (m *NodeManager) GetNodes(ctx context.Context) ([]string, error)
- func (m *NodeManager) HasLeader(ctx context.Context) (bool, error)
- func (m *NodeManager) IsLeader(ctx context.Context) (bool, error)
- func (m *NodeManager) KeepRegister(ctx context.Context) error
- func (m *NodeManager) SaveLeaderNodes(ctx context.Context, nodes []string) error
- func (m *NodeManager) Watch(ctx context.Context) (<-chan []string, error)
- type ShardManager
- func (s *ShardManager) DeleteRunningNode(ctx context.Context, taskName, node string) error
- func (s *ShardManager) DeleteRunningShard(ctx context.Context, taskName, node, shard string) error
- func (s *ShardManager) DeleteTask(ctx context.Context, taskName string) error
- func (s *ShardManager) GetRunningShards(ctx context.Context, taskName string) ([]string, error)
- func (s *ShardManager) GetShardsOnNode(ctx context.Context, taskName, node string) ([]string, error)
- func (s *ShardManager) Reset(ctx context.Context) error
- func (s *ShardManager) SaveTask(ctx context.Context, taskName string, shardsByNode map[string][]string) error
- func (s *ShardManager) SetShardRunning(ctx context.Context, taskName, node, shard string) error
- func (s *ShardManager) WatchForNewTask(ctx context.Context) (<-chan model.TaskNodeShardStore, error)
- func (s *ShardManager) WatchShardChange(ctx context.Context, taskName, node string) (<-chan model.Shards, error)
- type TaskManager
- func (t *TaskManager) GetAllTasks(ctx context.Context) ([]*model.TaskConfig, error)
- func (t *TaskManager) Put(ctx context.Context, value *model.TaskConfig) error
- func (t *TaskManager) Watch(ctx context.Context) (<-chan []*model.TaskConfig, error)
- func (t *TaskManager) WatchTaskConfig(ctx context.Context, taskName string) (<-chan *model.TaskConfig, error)
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) KeepRegister ¶
func (m *NodeManager) KeepRegister(ctx context.Context) error
func (*NodeManager) SaveLeaderNodes ¶
func (m *NodeManager) SaveLeaderNodes(ctx context.Context, nodes []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 (*ShardManager) GetShardsOnNode ¶
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 ¶
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)
Click to show internal directories.
Click to hide internal directories.