agent

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobStatusPending    = "Pending"
	JobStatusRunning    = "Running"
	JobStatusCancelling = "Cancelling"
	JobStatusCancelled  = "Cancelled"
	JobStatusFinished   = "Finished"
	JobStatusFailed     = "Failed"
)
View Source
const InboxPrefix = "_INBOX_"

Variables

View Source
var (
	ErrAgentNotFound      = errors.New("agent not found")
	ErrStorageExists      = errors.New("storage already exists")
	ErrStorageNotFound    = errors.New("storage not found")
	ErrFileNotFound       = errors.New("file not found")
	ErrInvalidStorageName = errors.New("invalid storage name")
	ErrJobNotFound        = errors.New("job not found")
)

Functions

func InboxName

func InboxName(name string) string

func NewAgentPermissions

func NewAgentPermissions(agentID string) jwt.Permissions

func StreamName

func StreamName(name string) string

Types

type Client

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

func New

func New(srv *server.Client) *Client

func (*Client) CreateStorage

func (c *Client) CreateStorage(ctx context.Context, name, description string) error

func (*Client) DeleteStorage

func (c *Client) DeleteStorage(ctx context.Context, name string) error

func (*Client) Discover

func (c *Client) Discover(ctx context.Context) (map[string]DiscoverResult, error)

func (*Client) GetJob

func (c *Client) GetJob(ctx context.Context, jobID string) (Job, error)

func (*Client) GetStorage

func (c *Client) GetStorage(ctx context.Context, name string) (*Storage, error)

func (*Client) ListAllJobs

func (c *Client) ListAllJobs(ctx context.Context) (map[string]Job, error)

func (*Client) ListJobs

func (c *Client) ListJobs(ctx context.Context, agentID string) (map[string]Job, error)

func (*Client) ListMessages

func (c *Client) ListMessages(ctx context.Context, agentID string, subjects []string) ([]Message, error)

func (*Client) ListStorage

func (c *Client) ListStorage(ctx context.Context) ([]*Storage, error)

func (*Client) Register

func (c *Client) Register(ctx context.Context, agentID string) (err error)

func (*Client) StartWorker

func (c *Client) StartWorker(ctx context.Context, agentID, workerID, command string, args, env []string) error

func (*Client) StopWorker

func (c *Client) StopWorker(ctx context.Context, agentID, workerID string) error

func (*Client) WriteWorkerStdin

func (c *Client) WriteWorkerStdin(ctx context.Context, agentID, workerID string) error

type DiscoverResult

type DiscoverResult struct {
	AgentID  string
	Username string
	Hostname string
	System   string
	Address  string
	LastSeen time.Time
}

type Job

type Job struct {
	ID      string
	AgentID string
	Command string
	Args    string
	Status  string
	Error   error
	Created time.Time
	Updated time.Time
}

type Message

type Message struct {
	ID       string
	Subject  string
	AgentID  string
	Sent     time.Time
	Received time.Time
	// contains filtered or unexported fields
}

func (*Message) Data

func (m *Message) Data() []byte

type Storage

type Storage struct {
	*natsfs.FS
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(ctx context.Context, store jetstream.ObjectStore) (*Storage, error)

func (*Storage) Close

func (o *Storage) Close() error

func (*Storage) Description

func (o *Storage) Description() string

func (*Storage) Name

func (o *Storage) Name() string

func (*Storage) Size

func (o *Storage) Size() uint64

Jump to

Keyboard shortcuts

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