agentsocket

package
v2.34.21 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 17 Imported by: 1 module, 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

View Source
var (
	ErrUnitManagerNotAvailable = xerrors.New("unit manager not available")
	ErrAgentAPINotConnected    = xerrors.New("agent not connected to coderd")
)

Functions

This section is empty.

Types

type Client

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

Client provides a client for communicating with the workspace agentsocket API.

func NewClient

func NewClient(ctx context.Context, opts ...Option) (*Client, error)

NewClient creates a new socket client and opens a connection to the socket. If path is not provided via WithPath or is empty, it will auto-discover the default socket path.

func (*Client) Close

func (c *Client) Close() error

Close closes the socket connection.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping sends a ping request to the agent.

func (*Client) SyncComplete

func (c *Client) SyncComplete(ctx context.Context, unitName unit.ID) error

SyncComplete marks a unit as complete in the dependency graph.

func (*Client) SyncReady

func (c *Client) SyncReady(ctx context.Context, unitName unit.ID) (bool, error)

SyncReady requests whether a unit is ready to be started. That is, all dependencies are satisfied.

func (*Client) SyncStart

func (c *Client) SyncStart(ctx context.Context, unitName unit.ID) error

SyncStart starts a unit in the dependency graph.

func (*Client) SyncStatus

func (c *Client) SyncStatus(ctx context.Context, unitName unit.ID) (SyncStatusResponse, error)

SyncStatus gets the status of a unit and its dependencies.

func (*Client) SyncWant

func (c *Client) SyncWant(ctx context.Context, unitName, dependsOn unit.ID) error

SyncWant declares a dependency between units.

func (*Client) UpdateAppStatus added in v2.32.0

UpdateAppStatus forwards an app status update to coderd via the agent.

type DRPCAgentSocketService

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

DRPCAgentSocketService implements the DRPC agent socket service.

func (*DRPCAgentSocketService) ClearAgentAPI added in v2.32.0

func (s *DRPCAgentSocketService) ClearAgentAPI()

ClearAgentAPI clears the agent API client. This is called when the agent disconnects from coderd.

func (*DRPCAgentSocketService) Ping

Ping responds to a ping request to check if the service is alive.

func (*DRPCAgentSocketService) SetAgentAPI added in v2.32.0

SetAgentAPI sets the agent API client used to forward requests to coderd. This is called when the agent connects to coderd.

func (*DRPCAgentSocketService) SyncComplete

SyncComplete marks a unit as complete in the dependency graph.

func (*DRPCAgentSocketService) SyncReady

SyncReady checks whether a unit is ready to be started. That is, all dependencies are satisfied.

func (*DRPCAgentSocketService) SyncStart

SyncStart starts a unit in the dependency graph.

func (*DRPCAgentSocketService) SyncStatus

SyncStatus gets the status of a unit and lists its dependencies.

func (*DRPCAgentSocketService) SyncWant

SyncWant declares a dependency between units.

func (*DRPCAgentSocketService) UpdateAppStatus added in v2.32.0

UpdateAppStatus forwards an app status update to coderd via the agent API. Returns an error if the agent is not connected.

type DependencyInfo

type DependencyInfo struct {
	DependsOn      unit.ID     `table:"depends on,default_sort" json:"depends_on"`
	RequiredStatus unit.Status `table:"required status" json:"required_status"`
	CurrentStatus  unit.Status `table:"current status" json:"current_status"`
	IsSatisfied    bool        `table:"satisfied" json:"is_satisfied"`
}

DependencyInfo contains information about a unit dependency.

type Option

type Option func(*options)

Option represents a configuration option for NewClient.

func WithPath

func WithPath(path string) Option

WithPath sets the socket path. If not provided or empty, the client will auto-discover the default socket path.

type Server

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

Server provides access to the DRPCAgentSocketService via a Unix domain socket. Do not invoke Server{} directly. Use NewServer() instead.

func NewServer

func NewServer(logger slog.Logger, opts ...Option) (*Server, error)

NewServer creates a new agent socket server.

func (*Server) ClearAgentAPI added in v2.32.0

func (s *Server) ClearAgentAPI()

ClearAgentAPI clears the agent API client.

func (*Server) Close

func (s *Server) Close() error

Close stops the server and cleans up resources.

func (*Server) SetAgentAPI added in v2.32.0

func (s *Server) SetAgentAPI(api agentproto.DRPCAgentClient28)

SetAgentAPI sets the agent API client used to forward requests to coderd.

type SyncStatusResponse

type SyncStatusResponse struct {
	UnitName     unit.ID          `table:"unit,default_sort" json:"unit_name"`
	Status       unit.Status      `table:"status" json:"status"`
	IsReady      bool             `table:"ready" json:"is_ready"`
	Dependencies []DependencyInfo `table:"dependencies" json:"dependencies"`
}

SyncStatusResponse contains the status information for a unit.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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