dispatcher

package
v0.0.0-...-8010d25 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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

Jump to

Keyboard shortcuts

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