agent

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: Apache-2.0 Imports: 12 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_"
View Source
const StreamPrefix = "FJ_"

Variables

This section is empty.

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) CreateConsumer

func (c *Client) CreateConsumer(ctx context.Context, agentID string, subjects []string) (jetstream.Consumer, error)

func (*Client) Discover

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

func (*Client) ListAgentIDs

func (c *Client) ListAgentIDs(ctx context.Context) ([]string, 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) 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
	Created  time.Time
	LastSeen time.Time
}

type Job

type Job struct {
	ID      string
	AgentID string
	Command string
	Args    string
	Status  string
	Error   error
}

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

Jump to

Keyboard shortcuts

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