manager

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	InventoryStore inventorystore.Store // For rack/component lookups (read-only)
	TaskStore      taskstore.Store      // For task persistence
	ExecutorConfig executor.ExecutorConfig

	// MaxWaitingTasksPerRack is the maximum number of queued tasks allowed per
	// rack. Zero uses the default (5).
	MaxWaitingTasksPerRack int
	// DefaultQueueTimeout is the expiry duration for tasks that do not supply
	// their own QueueTimeout. Zero uses the default (1 hour).
	DefaultQueueTimeout time.Duration
	// PromoterConfig tunes the Promoter's sweep interval and channel size.
	// Zero values use the Promoter's own defaults.
	PromoterConfig conflict.PromoterConfig
}

Config holds the configuration for the task manager.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the Config is missing required fields.

type Manager

type Manager interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context)
	SubmitTask(ctx context.Context, req *operation.Request) ([]uuid.UUID, error)
	CancelTask(ctx context.Context, taskID uuid.UUID) error
}

Manager defines the public interface for task lifecycle management.

type ManagerImpl

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

ManagerImpl maintains unfinished tasks, schedules them via temporal workflows, and monitors their progress.

func New

func New(ctx context.Context, conf *Config) (*ManagerImpl, error)

New creates a new task manager.

func (*ManagerImpl) CancelTask

func (m *ManagerImpl) CancelTask(ctx context.Context, taskID uuid.UUID) error

CancelTask cancels a task by its ID. Waiting tasks are terminated immediately (no workflow to stop). Pending/running tasks have their Temporal workflow terminated. Already-terminated tasks return nil (idempotent). Completed or failed tasks return an error.

func (*ManagerImpl) Start

func (m *ManagerImpl) Start(ctx context.Context) error

Start starts the task manager to make it ready to accept tasks.

func (*ManagerImpl) Stop

func (m *ManagerImpl) Stop(ctx context.Context)

Stop shuts down the manager and waits for all routines to finish.

func (*ManagerImpl) SubmitTask

func (m *ManagerImpl) SubmitTask(
	ctx context.Context,
	req *operation.Request,
) ([]uuid.UUID, error)

SubmitTask submits a task to the task manager. The TargetSpec is resolved to racks via inventory; one Task is created per rack. Returns the IDs of all created tasks.

type TargetFetcher

type TargetFetcher interface {
	GetRackByIdentifier(ctx context.Context, identifier identifier.Identifier, withComponents bool) (*rack.Rack, error)
	GetComponentByID(ctx context.Context, id uuid.UUID) (*component.Component, error)
	GetComponentsByExternalIDs(ctx context.Context, externalIDs []string) ([]*component.Component, error)
}

TargetFetcher provides the methods needed to fetch racks and components for target resolution.

Jump to

Keyboard shortcuts

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