operation

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentTarget

type ComponentTarget struct {
	UUID     uuid.UUID    // RLA internal UUID (one of UUID or External must be set)
	External *ExternalRef // External system reference (one of UUID or External must be set)
}

ComponentTarget identifies a specific component. Either UUID or External must be set, but not both.

func (*ComponentTarget) TargetIdentifier added in v1.3.1

func (ct *ComponentTarget) TargetIdentifier() string

func (*ComponentTarget) Validate

func (ct *ComponentTarget) Validate() error

type ConflictStrategy

type ConflictStrategy int

ConflictStrategy controls how a task behaves when a conflict is detected.

const (
	// ConflictStrategyReject immediately rejects the task when a conflict is detected (default).
	ConflictStrategyReject ConflictStrategy = iota
	// ConflictStrategyQueue queues the task until the conflicting task completes.
	ConflictStrategyQueue
)

type ExternalRef

type ExternalRef struct {
	Type devicetypes.ComponentType // Component type determines the source system
	ID   string                    // Component ID from the component manager service
}

ExternalRef identifies a component by its external system ID. The component type determines which external system to query

func (*ExternalRef) Validate

func (er *ExternalRef) Validate() error

type RackTarget

type RackTarget struct {
	Identifier     identifier.Identifier       // Rack identifier (ID or Name, at least one must be set)
	ComponentTypes []devicetypes.ComponentType // Optional: filter by type; empty = ALL component types in rack
}

RackTarget identifies a rack with optional component type filtering. To target specific components, use the component-level APIs instead.

func (*RackTarget) Validate

func (rt *RackTarget) Validate() error

type Request

type Request struct {
	Operation   Wrapper
	TargetSpec  TargetSpec // Either racks or components, not both
	Description string

	// ConflictStrategy controls how the task behaves when a conflict is
	// detected. Default (ConflictStrategyReject) rejects on conflict.
	ConflictStrategy ConflictStrategy

	// QueueTimeout is how long to wait in queue before auto-expiry. Zero
	// means use the server default. The server may enforce a maximum.
	// Only relevant when ConflictStrategy is ConflictStrategyQueue.
	QueueTimeout time.Duration

	// Optional: override rule resolution with a specific rule
	RuleID *uuid.UUID

	// RequiredRackID, when non-zero, causes SubmitTask to return an error
	// (and create no tasks) if the resolved targets do not belong exclusively
	// to this rack. Use this for component-targeting requests where the scope
	// was originally written against a specific rack, to guard against the
	// case where all listed components have since been moved to a different
	// single rack or span multiple racks.
	//
	// This field only handles the single-rack enforcement case. If a future
	// caller needs to constrain resolution to a known set of multiple racks,
	// this would need to become []uuid.UUID (or a separate AllowedRackIDs
	// field). Do not add that generalization until there is a concrete caller.
	RequiredRackID uuid.UUID
}

Request represents the specification of an operation submitted by the user. The Task Manager resolves the TargetSpec, splits by rack, and creates one Task per rack.

func (*Request) Validate

func (r *Request) Validate() error

type TargetSpec

type TargetSpec struct {
	Racks      []RackTarget      // Set if targeting racks (mutually exclusive with Components)
	Components []ComponentTarget // Set if targeting components (mutually exclusive with Racks)
}

TargetSpec contains either rack targets or component targets, but not both. This enforces single-type targeting at the type level.

func (*TargetSpec) IsComponentTargeting

func (ts *TargetSpec) IsComponentTargeting() bool

IsComponentTargeting returns true if this spec targets components.

func (*TargetSpec) IsRackTargeting

func (ts *TargetSpec) IsRackTargeting() bool

IsRackTargeting returns true if this spec targets racks.

func (*TargetSpec) Validate

func (ts *TargetSpec) Validate() error

Validate validates the target specification

type Wrapper

type Wrapper struct {
	Type taskcommon.TaskType
	Code string          // Operation code string (e.g., "power_on", "upgrade")
	Info json.RawMessage // Serialized operation details
}

Wrapper wraps the operation type and its serialized information.

Jump to

Keyboard shortcuts

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