manager

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

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

type Manager

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

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

func New

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

New creates a new task manager.

func (*Manager) CancelTask

func (m *Manager) 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 (*Manager) Start

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

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

func (*Manager) Stop

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

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

func (*Manager) SubmitTask

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

SubmitTask submits a task to the task manager. operation.Request can contain multiple racks. Task Manager resolves identifiers, splits by rack, and creates one Task per rack. Returns a list of created task IDs.

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