Documentation
¶
Index ¶
- Variables
- type Event
- func NewWorkerAddedEvent(managerId string, worker Worker) Event
- func NewWorkerDeletedEvent(managerId string, worker Worker) Event
- func NewWorkloadAddedEvent(managerId string, workload Workload) Event
- func NewWorkloadDeletedEvent(managerId string, workload Workload) Event
- func NewWorkloadDistributedErrorEvent(managerId, workerId string, workload Workload) Event
- func NewWorkloadDistributedEvent(managerId, workerId string, workload Workload) Event
- type EventType
- type Manager
- func (m *Manager) AddWorker(ctx context.Context, w Worker) error
- func (m *Manager) AddWorkload(ctx context.Context, wl Workload) error
- func (m *Manager) Assign(w Worker, wl Workload)
- func (m *Manager) Associate(ctx context.Context, wl Workload, w Worker) error
- func (m *Manager) DeleteWorker(ctx context.Context, w Worker) error
- func (m *Manager) DeleteWorkload(ctx context.Context, wl Workload) error
- func (m *Manager) GetAssociation(ctx context.Context, wl Workload) (Worker, error)
- func (m *Manager) GetAssosiactions(ctx context.Context, w Worker) ([]Workload, error)
- func (m *Manager) GetWorker(ctx context.Context, id string) (Worker, error)
- func (m *Manager) GetWorkload(ctx context.Context, id string) (Workload, error)
- func (m *Manager) Stop() error
- func (m *Manager) Workers(ctx context.Context) ([]Worker, error)
- func (m *Manager) Workloads(ctx context.Context) ([]Workload, error)
- type MemoryStore
- func (s *MemoryStore) AddWorker(_ context.Context, w Worker) error
- func (s *MemoryStore) AddWorkload(_ context.Context, wl Workload) error
- func (s *MemoryStore) Associate(_ context.Context, wl Workload, w Worker) error
- func (s *MemoryStore) DeleteWorker(_ context.Context, w Worker) error
- func (s *MemoryStore) DeleteWorkload(_ context.Context, wl Workload) error
- func (s *MemoryStore) Disassociate(_ context.Context, wl Workload, w Worker) error
- func (s *MemoryStore) GetAllWorkers(_ context.Context) ([]Worker, error)
- func (s *MemoryStore) GetAllWorkloads(_ context.Context) ([]Workload, error)
- func (s *MemoryStore) GetAssociation(_ context.Context, wl Workload) (Worker, error)
- func (s *MemoryStore) GetAssociations(_ context.Context, w Worker) ([]Workload, error)
- func (s *MemoryStore) GetWorker(_ context.Context, id string) (Worker, error)
- func (s *MemoryStore) GetWorkload(_ context.Context, id string) (Workload, error)
- func (s *MemoryStore) Lock()
- func (s *MemoryStore) Unlock()
- func (s *MemoryStore) UpdateWorkload(_ context.Context, wl Workload) error
- type Option
- func WithCleanupInterval(t time.Duration) Option
- func WithCleanupMaxTime(t time.Duration) Option
- func WithDistributorInterval(t time.Duration) Option
- func WithManagerID(id string) Option
- func WithMaxDelta(d int) Option
- func WithRebalanceInterval(t time.Duration) Option
- func WithSignaller(signaller Signals) Option
- func WithStateStorage(state StateStorage) Option
- type Signals
- type Slog
- type SlogSignaller
- type StateStorage
- type Status
- type Worker
- type Workload
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWorkerNotFound = errors.New("no such worker") ErrWorkloadNotFound = errors.New("no such workload") ErrMissingAssociation = errors.New("missing association") )
View Source
var (
ErrInvalidEvent = errors.New("invalid event type")
)
View Source
var ErrWorkerExists = errors.New("worker already exists")
View Source
var ErrWorkloadExists = errors.New("workload already exists")
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Type EventType `json:"type"`
ManagerID string `json:"managerId"`
ResourceID string `json:"resourceId"`
WorkerID string `json:"workerId,omitempty"`
}
func NewWorkerAddedEvent ¶
func NewWorkerDeletedEvent ¶
func NewWorkloadAddedEvent ¶
func NewWorkloadDeletedEvent ¶
type EventType ¶
type EventType int
func (EventType) MarshalJSON ¶
func (*EventType) UnmarshalJSON ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Assign ¶ added in v0.1.4
Assign a workload to a worker, commonly used to backfill when a manager is started post worker startup. Bypasses distribution steps for the workload.
func (*Manager) DeleteWorkload ¶
func (*Manager) GetAssociation ¶ added in v0.1.11
func (*Manager) GetAssosiactions ¶ added in v0.1.11
func (*Manager) GetWorkload ¶ added in v0.1.9
type MemoryStore ¶ added in v0.1.11
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶ added in v0.1.11
func NewMemoryStore() *MemoryStore
func (*MemoryStore) AddWorker ¶ added in v0.1.11
func (s *MemoryStore) AddWorker(_ context.Context, w Worker) error
func (*MemoryStore) AddWorkload ¶ added in v0.1.11
func (s *MemoryStore) AddWorkload(_ context.Context, wl Workload) error
func (*MemoryStore) DeleteWorker ¶ added in v0.1.11
func (s *MemoryStore) DeleteWorker(_ context.Context, w Worker) error
func (*MemoryStore) DeleteWorkload ¶ added in v0.1.11
func (s *MemoryStore) DeleteWorkload(_ context.Context, wl Workload) error
func (*MemoryStore) Disassociate ¶ added in v0.1.11
func (*MemoryStore) GetAllWorkers ¶ added in v0.1.11
func (s *MemoryStore) GetAllWorkers(_ context.Context) ([]Worker, error)
func (*MemoryStore) GetAllWorkloads ¶ added in v0.1.11
func (s *MemoryStore) GetAllWorkloads(_ context.Context) ([]Workload, error)
func (*MemoryStore) GetAssociation ¶ added in v0.1.11
func (*MemoryStore) GetAssociations ¶ added in v0.1.11
func (*MemoryStore) GetWorkload ¶ added in v0.1.11
func (*MemoryStore) Lock ¶ added in v0.1.11
func (s *MemoryStore) Lock()
func (*MemoryStore) Unlock ¶ added in v0.1.11
func (s *MemoryStore) Unlock()
func (*MemoryStore) UpdateWorkload ¶ added in v0.1.11
func (s *MemoryStore) UpdateWorkload(_ context.Context, wl Workload) error
type Option ¶
type Option func(*Manager)
func WithCleanupInterval ¶
func WithCleanupMaxTime ¶
func WithDistributorInterval ¶
func WithMaxDelta ¶ added in v0.1.18
func WithRebalanceInterval ¶
func WithSignaller ¶ added in v0.1.11
func WithStateStorage ¶ added in v0.1.11
func WithStateStorage(state StateStorage) Option
type SlogSignaller ¶ added in v0.1.11
type SlogSignaller struct {
// contains filtered or unexported fields
}
func NewSlogSignaller ¶ added in v0.1.11
func NewSlogSignaller(instance Slog) *SlogSignaller
func (*SlogSignaller) Error ¶ added in v0.1.11
func (s *SlogSignaller) Error(err error)
func (*SlogSignaller) Event ¶ added in v0.1.11
func (s *SlogSignaller) Event(e Event)
type StateStorage ¶ added in v0.1.11
type StateStorage interface {
Lock()
Unlock()
GetAllWorkers(context.Context) ([]Worker, error)
GetWorker(context.Context, string) (Worker, error)
AddWorker(context.Context, Worker) error
DeleteWorker(context.Context, Worker) error
GetAllWorkloads(context.Context) ([]Workload, error)
GetWorkload(context.Context, string) (Workload, error)
AddWorkload(context.Context, Workload) error
UpdateWorkload(context.Context, Workload) error
DeleteWorkload(context.Context, Workload) error
GetAssociation(context.Context, Workload) (Worker, error)
GetAssociations(context.Context, Worker) ([]Workload, error)
Associate(context.Context, Workload, Worker) error
Disassociate(context.Context, Workload, Worker) error
}
type Status ¶ added in v0.1.11
type Status uint8
func (Status) MarshalJSON ¶ added in v0.1.11
func (*Status) UnmarshalJSON ¶ added in v0.1.11
Click to show internal directories.
Click to hide internal directories.