Help us shape the future of Go! Take the 2026 Go Developer Survey

operation

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	OperationID string
	State       OperationState
	Timestamp   time.Time
	Message     string
	Progress    int
	Error       error
}

type Manager

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

func NewManager

func NewManager(q *queue.Queue) *Manager

func (*Manager) Cancel

func (m *Manager) Cancel(opID string) error

Cancel cancels a running operation

func (*Manager) CreateOperation

func (m *Manager) CreateOperation(opType OperationType, metadata map[string]string) string

CreateOperation creates a new operation

func (*Manager) EmitEvent

func (m *Manager) EmitEvent(opID string, message string)

EmitEvent sends a message event

func (*Manager) GetOperation

func (m *Manager) GetOperation(opID string) (*Operation, error)

GetOperation retrieves operation by ID

func (*Manager) GetPendingQueueCount

func (m *Manager) GetPendingQueueCount() int

GetPendingQueueCount returns the number of operations waiting in the queue

func (*Manager) IsConnected

func (m *Manager) IsConnected() bool

IsConnected returns true if the agent is connected to core

func (*Manager) ListOperations

func (m *Manager) ListOperations(filter func(*Operation) bool) []*Operation

ListOperations returns all operations

func (*Manager) SetCompleted

func (m *Manager) SetCompleted(opID string)

SetCompleted marks operation as completed

func (*Manager) SetConnectionState

func (m *Manager) SetConnectionState(connected bool)

SetConnectionState updates the connection state and processes queued operations

func (*Manager) SetError

func (m *Manager) SetError(opID string, err error)

SetError marks operation as failed

func (*Manager) SetProgress

func (m *Manager) SetProgress(opID string, progress int)

SetProgress updates operation progress

func (*Manager) SetState

func (m *Manager) SetState(opID string, state OperationState)

SetState updates operation state

func (*Manager) Subscribe

func (m *Manager) Subscribe(opID string) <-chan Event

Subscribe adds a listener for operation events

func (*Manager) Unsubscribe

func (m *Manager) Unsubscribe(opID string, ch <-chan Event)

Unsubscribe removes a listener for operation events

type Operation

type Operation struct {
	ID          string
	Type        OperationType
	State       OperationState
	CreatedAt   time.Time
	CompletedAt *time.Time
	Error       error
	Progress    int
	Metadata    map[string]string
	// contains filtered or unexported fields
}

type OperationState

type OperationState int
const (
	OperationStatePending OperationState = iota
	OperationStateRunning
	OperationStateCompleted
	OperationStateFailed
	OperationStateCancelled
)

type OperationType

type OperationType string
const (
	OperationTypeStackApply  OperationType = "stack.apply"
	OperationTypeStackRemove OperationType = "stack.remove"
	OperationTypeImagePull   OperationType = "image.pull"
	OperationTypeExec        OperationType = "container.exec"
	OperationTypeBackup      OperationType = "backup"
)

Jump to

Keyboard shortcuts

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