Documentation ¶
Index ¶
- type ConsistentHashDispatcher
- func (c *ConsistentHashDispatcher) AddService(serviceId string) error
- func (c *ConsistentHashDispatcher) AddTask(task *model.Task) error
- func (c *ConsistentHashDispatcher) DelService(serviceId string) error
- func (c *ConsistentHashDispatcher) DelTask(taskId string) error
- func (c *ConsistentHashDispatcher) GetServiceIdByTaskId(taskId string) string
- func (c *ConsistentHashDispatcher) GetTaskByServiceId(serviceId string) []*model.Task
- func (c *ConsistentHashDispatcher) GetTotalTaskNum() int
- func (c *ConsistentHashDispatcher) RemoveTask(taskId string) error
- type IDispatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsistentHashDispatcher ¶
type ConsistentHashDispatcher struct { sync.Mutex Tasks map[string]*model.Task ServiceWithTasks map[string]map[string]*model.Task // contains filtered or unexported fields }
func NewConsistentHashDispatcher ¶
func NewConsistentHashDispatcher() *ConsistentHashDispatcher
func (*ConsistentHashDispatcher) AddService ¶
func (c *ConsistentHashDispatcher) AddService(serviceId string) error
func (*ConsistentHashDispatcher) AddTask ¶
func (c *ConsistentHashDispatcher) AddTask(task *model.Task) error
func (*ConsistentHashDispatcher) DelService ¶
func (c *ConsistentHashDispatcher) DelService(serviceId string) error
func (*ConsistentHashDispatcher) DelTask ¶
func (c *ConsistentHashDispatcher) DelTask(taskId string) error
func (*ConsistentHashDispatcher) GetServiceIdByTaskId ¶
func (c *ConsistentHashDispatcher) GetServiceIdByTaskId(taskId string) string
func (*ConsistentHashDispatcher) GetTaskByServiceId ¶
func (c *ConsistentHashDispatcher) GetTaskByServiceId(serviceId string) []*model.Task
func (*ConsistentHashDispatcher) GetTotalTaskNum ¶
func (c *ConsistentHashDispatcher) GetTotalTaskNum() int
func (*ConsistentHashDispatcher) RemoveTask ¶
func (c *ConsistentHashDispatcher) RemoveTask(taskId string) error
type IDispatcher ¶
type IDispatcher interface { AddService(serviceId string) error DelService(serviceId string) error AddTask(task *model.Task) error RemoveTask(taskId string) error GetTaskByServiceId(serviceId string) []*model.Task GetServiceIdByTaskId(taskId string) string GetTotalTaskNum() int }
IDispatcher is a task dispatcher that dispatch tasks to agent services the task will be assigned to a unique agent service at single point in time
Click to show internal directories.
Click to hide internal directories.