Documentation
¶
Index ¶
- func GetDefaultSocketPath() string
- func IsDaemonRunning(socketPath string) bool
- type Client
- func (c *Client) Close() error
- func (c *Client) Connect() error
- func (c *Client) GetForkInfo(ctx context.Context, forkID string) (*ForkInfo, error)
- func (c *Client) GetVersion(ctx context.Context) (*GetVersionResponse, error)
- func (c *Client) HealthCheck(ctx context.Context) error
- func (c *Client) ListForks(ctx context.Context) ([]ForkInfo, error)
- func (c *Client) RefreshAll(ctx context.Context) error
- func (c *Client) RefreshFork(ctx context.Context, forkID string) error
- func (c *Client) RegisterFork(ctx context.Context, req RegisterForkRequest) error
- func (c *Client) RequestForkID(ctx context.Context) (string, error)
- func (c *Client) TriggerDiscovery(ctx context.Context) error
- func (c *Client) UnregisterFork(ctx context.Context, forkID string) error
- type Daemon
- type DaemonState
- type ErrorResponse
- type ForkInfo
- type GetForkInfoRequest
- type GetVersionResponse
- type ListForksResponse
- type Message
- type MessageType
- type RefreshAllRequest
- type RefreshForkRequest
- type RegisterForkRequest
- type RequestForkIDResponse
- type ServiceInfo
- type SuccessResponse
- type UnregisterForkRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultSocketPath ¶
func GetDefaultSocketPath() string
GetDefaultSocketPath returns the default socket path
func IsDaemonRunning ¶
IsDaemonRunning checks if the daemon is running
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client connection to the worklet daemon
func (*Client) GetForkInfo ¶
GetForkInfo returns information about a specific fork
func (*Client) GetVersion ¶
func (c *Client) GetVersion(ctx context.Context) (*GetVersionResponse, error)
GetVersion returns the version information of the running daemon
func (*Client) HealthCheck ¶
HealthCheck checks if the daemon is running
func (*Client) RefreshAll ¶
RefreshAll refreshes information for all forks
func (*Client) RefreshFork ¶
RefreshFork refreshes information for a specific fork
func (*Client) RegisterFork ¶
func (c *Client) RegisterFork(ctx context.Context, req RegisterForkRequest) error
RegisterFork registers a new fork with the daemon
func (*Client) RequestForkID ¶
RequestForkID requests a new fork ID from the daemon
func (*Client) TriggerDiscovery ¶
TriggerDiscovery triggers the daemon to discover containers immediately
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon represents the worklet daemon server
type DaemonState ¶
type DaemonState struct {
NextForkID int `json:"next_fork_id"`
}
DaemonState represents the persistent state of the daemon
type ErrorResponse ¶
ErrorResponse is sent when an error occurs
type ForkInfo ¶
type ForkInfo struct {
ForkID string `json:"fork_id"`
ProjectName string `json:"project_name"`
ContainerID string `json:"container_id,omitempty"`
WorkDir string `json:"work_dir"`
Services []ServiceInfo `json:"services,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
RegisteredAt time.Time `json:"registered_at"`
LastSeenAt time.Time `json:"last_seen_at"`
}
ForkInfo contains information about a registered fork
type GetForkInfoRequest ¶
type GetForkInfoRequest struct {
ForkID string `json:"fork_id"`
}
GetForkInfoRequest requests information about a specific fork
type GetVersionResponse ¶
type GetVersionResponse struct {
Version string `json:"version"`
BuildTime string `json:"build_time,omitempty"`
GitCommit string `json:"git_commit,omitempty"`
StartTime string `json:"start_time,omitempty"`
}
GetVersionResponse contains version information
type ListForksResponse ¶
type ListForksResponse struct {
Forks []ForkInfo `json:"forks"`
}
ListForksResponse contains a list of all registered forks
type Message ¶
type Message struct {
Type MessageType `json:"type"`
ID string `json:"id,omitempty"` // Request ID for correlation
Payload json.RawMessage `json:"payload,omitempty"`
}
Message represents a message between client and daemon
type MessageType ¶
type MessageType string
MessageType represents the type of message sent between client and daemon
const ( // Client -> Daemon messages MsgRegisterFork MessageType = "REGISTER_FORK" MsgUnregisterFork MessageType = "UNREGISTER_FORK" MsgListForks MessageType = "LIST_FORKS" MsgGetForkInfo MessageType = "GET_FORK_INFO" MsgProxyRegister MessageType = "PROXY_REGISTER" MsgHealthCheck MessageType = "HEALTH_CHECK" MsgRefreshFork MessageType = "REFRESH_FORK" MsgRefreshAll MessageType = "REFRESH_ALL" MsgRequestForkID MessageType = "REQUEST_FORK_ID" MsgTriggerDiscovery MessageType = "TRIGGER_DISCOVERY" MsgGetVersion MessageType = "GET_VERSION" // Daemon -> Client responses MsgSuccess MessageType = "SUCCESS" MsgError MessageType = "ERROR" MsgForkList MessageType = "FORK_LIST" MsgForkInfo MessageType = "FORK_INFO" MsgForkID MessageType = "FORK_ID" MsgVersion MessageType = "VERSION" )
type RefreshAllRequest ¶
type RefreshAllRequest struct {
}
RefreshAllRequest is sent to refresh all forks
type RefreshForkRequest ¶
type RefreshForkRequest struct {
ForkID string `json:"fork_id"`
}
RefreshForkRequest is sent to refresh a specific fork's information
type RegisterForkRequest ¶
type RegisterForkRequest struct {
ForkID string `json:"fork_id"`
ProjectName string `json:"project_name"`
ContainerID string `json:"container_id,omitempty"`
WorkDir string `json:"work_dir"`
Services []ServiceInfo `json:"services,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
RegisterForkRequest is sent when a new fork is created
type RequestForkIDResponse ¶
type RequestForkIDResponse struct {
ForkID string `json:"fork_id"`
}
RequestForkIDResponse contains the next available fork ID
type ServiceInfo ¶
type ServiceInfo struct {
Name string `json:"name"`
Port int `json:"port"`
Subdomain string `json:"subdomain"`
}
ServiceInfo describes a service exposed by a fork
type SuccessResponse ¶
type SuccessResponse struct {
Message string `json:"message,omitempty"`
}
SuccessResponse is sent for successful operations
type UnregisterForkRequest ¶
type UnregisterForkRequest struct {
ForkID string `json:"fork_id"`
}
UnregisterForkRequest is sent when a fork is being removed