command

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: GPL-3.0 Imports: 11 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 CompleteInput

type CompleteInput struct {
	TenantID  string          `json:"tenant_id" validate:"required,uuid"`
	CommandID string          `json:"command_id" validate:"required,uuid"`
	Result    json.RawMessage `json:"result,omitempty"`
}

CompleteInput represents the input for completing a command.

type CreateInput

type CreateInput struct {
	TenantID  string          `json:"tenant_id" validate:"required,uuid"`
	AgentID   string          `json:"agent_id,omitempty" validate:"omitempty,uuid"`
	Type      string          `json:"type" validate:"required,oneof=scan collect health_check config_update cancel"`
	Priority  string          `json:"priority" validate:"omitempty,oneof=low normal high critical"`
	Payload   json.RawMessage `json:"payload,omitempty"`
	ExpiresIn int             `json:"expires_in,omitempty"` // Seconds until expiration
}

CreateInput represents the input for creating a command.

type ExpirationChecker

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

ExpirationChecker periodically checks for expired commands and handles them.

func NewExpirationChecker

func NewExpirationChecker(
	commandRepo commanddom.Repository,
	pipelineService *pipeline.Service,
	cfg ExpirationCheckerConfig,
	log *logger.Logger,
) *ExpirationChecker

NewExpirationChecker creates a new ExpirationChecker.

func (*ExpirationChecker) Start

func (c *ExpirationChecker) Start()

Start starts the command expiration checker.

func (*ExpirationChecker) Stop

func (c *ExpirationChecker) Stop()

Stop stops the command expiration checker gracefully.

type ExpirationCheckerConfig

type ExpirationCheckerConfig struct {
	// CheckInterval is how often to check for expired commands (default: 1 minute)
	CheckInterval time.Duration
}

ExpirationCheckerConfig holds configuration for the command expiration checker.

type FailInput

type FailInput struct {
	TenantID     string `json:"tenant_id" validate:"required,uuid"`
	CommandID    string `json:"command_id" validate:"required,uuid"`
	ErrorMessage string `json:"error_message"`
}

FailInput represents the input for failing a command.

type ListInput

type ListInput struct {
	TenantID string `json:"tenant_id" validate:"required,uuid"`
	AgentID  string `json:"agent_id,omitempty" validate:"omitempty,uuid"`
	Type     string `json:"type" validate:"omitempty,oneof=scan collect health_check config_update cancel"`
	Status   string `json:"status" validate:"omitempty,oneof=pending acknowledged running completed failed canceled expired"`
	Priority string `json:"priority" validate:"omitempty,oneof=low normal high critical"`
	Page     int    `json:"page"`
	PerPage  int    `json:"per_page"`
}

ListInput represents the input for listing commands.

type PollInput

type PollInput struct {
	TenantID string `json:"tenant_id" validate:"required,uuid"`
	AgentID  string `json:"agent_id,omitempty" validate:"omitempty,uuid"`
	Limit    int    `json:"limit" validate:"min=1,max=100"`
}

PollInput represents the input for polling commands.

type Service

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

Service handles command-related business operations.

func NewService

func NewService(repo commanddom.Repository, log *logger.Logger) *Service

NewService creates a new Service.

func (*Service) Acknowledge

func (s *Service) Acknowledge(ctx context.Context, tenantID, commandID string) (*commanddom.Command, error)

Acknowledge marks a command as acknowledged.

func (*Service) CancelCommand

func (s *Service) CancelCommand(ctx context.Context, tenantID, commandID string) (*commanddom.Command, error)

CancelCommand marks a command as canceled.

func (*Service) Complete

func (s *Service) Complete(ctx context.Context, input CompleteInput) (*commanddom.Command, error)

Complete marks a command as completed.

func (*Service) Create

func (s *Service) Create(ctx context.Context, input CreateInput) (*commanddom.Command, error)

Create creates a new command.

func (*Service) DeleteCommand

func (s *Service) DeleteCommand(ctx context.Context, tenantID, commandID string) error

DeleteCommand deletes a command.

func (*Service) ExpireOldCommands

func (s *Service) ExpireOldCommands(ctx context.Context) (int64, error)

ExpireOldCommands expires old pending commands.

func (*Service) Fail

func (s *Service) Fail(ctx context.Context, input FailInput) (*commanddom.Command, error)

Fail marks a command as failed.

func (*Service) Get

func (s *Service) Get(ctx context.Context, tenantID, commandID string) (*commanddom.Command, error)

Get retrieves a command by ID.

func (*Service) List

List lists commands with filters.

func (*Service) Poll

func (s *Service) Poll(ctx context.Context, input PollInput) ([]*commanddom.Command, error)

Poll retrieves pending commands for an agent.

func (*Service) Start

func (s *Service) Start(ctx context.Context, tenantID, commandID string) (*commanddom.Command, error)

Start marks a command as running.

Jump to

Keyboard shortcuts

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