Documentation
¶
Index ¶
- func GetDefaultBaseURL() string
- type AgentConfigResponse
- type AgentInfo
- type AgentListResponse
- type AgentMetricsRequest
- type AgentRegisterRequest
- type AgentRegisterResponse
- type AgentStatusEvent
- type AgentStatusRequest
- type AgentStatusResponse
- type Client
- func (c *Client) CreateShare(ctx context.Context, req *ShareCreateRequest) (*ShareInfo, error)
- func (c *Client) CreateWorker(ctx context.Context, req *WorkerCreateRequest) (*WorkerInfo, error)
- func (c *Client) DeleteAgent(ctx context.Context, agentID string) error
- func (c *Client) DeleteShare(ctx context.Context, shareID string) error
- func (c *Client) DeleteWorker(ctx context.Context, workerID string) error
- func (c *Client) GenerateToken(ctx context.Context, tokenType string) (*TokenResponse, error)
- func (c *Client) GetAgent(ctx context.Context, agentID string) (*AgentInfo, error)
- func (c *Client) GetAgentConfig(ctx context.Context, agentID string) (*AgentConfigResponse, error)
- func (c *Client) GetBaseURL() string
- func (c *Client) GetReleases(ctx context.Context, vendor string, size int) (*ReleasesResponse, error)
- func (c *Client) GetSharePublic(ctx context.Context, shortCode string) (*SharePublicInfo, error)
- func (c *Client) GetWorker(ctx context.Context, workerID string) (*WorkerInfo, error)
- func (c *Client) ListAgents(ctx context.Context) (*AgentListResponse, error)
- func (c *Client) ListShares(ctx context.Context) (*ShareListResponse, error)
- func (c *Client) ListWorkers(ctx context.Context, agentID, hostname string) (*WorkerListResponse, error)
- func (c *Client) RegisterAgent(ctx context.Context, tempToken string, req *AgentRegisterRequest) (*AgentRegisterResponse, error)
- func (c *Client) ReportAgentMetrics(ctx context.Context, agentID string, req *AgentMetricsRequest) error
- func (c *Client) ReportAgentStatus(ctx context.Context, agentID string, req *AgentStatusRequest) (*AgentStatusResponse, error)
- func (c *Client) SetAgentSecret(secret string)
- func (c *Client) SetBaseURL(url string)
- func (c *Client) SetUserToken(token string)
- func (c *Client) UpdateWorker(ctx context.Context, workerID string, req *WorkerUpdateRequest) (*WorkerInfo, error)
- type ClientOption
- type ConnectionInfo
- type GPUInfo
- type GPUMetrics
- type GPUStatus
- type HeartbeatResponse
- type IsolationModeType
- type License
- type ReleaseArtifact
- type ReleaseInfo
- type ReleaseRequirements
- type ReleasesResponse
- type ShareCreateRequest
- type ShareInfo
- type ShareListResponse
- type SharePublicInfo
- type SuccessResponse
- type SystemMetrics
- type TokenResponse
- type VendorInfo
- type WorkerConfig
- type WorkerCreateRequest
- type WorkerInfo
- type WorkerListResponse
- type WorkerStatus
- type WorkerUpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultBaseURL ¶
func GetDefaultBaseURL() string
GetDefaultBaseURL returns the default base URL, checking GPU_GO_ENDPOINT env var first
Types ¶
type AgentConfigResponse ¶
type AgentConfigResponse struct {
ConfigVersion int `json:"config_version"`
Workers []WorkerConfig `json:"workers"`
License License `json:"license"`
}
AgentConfigResponse represents the response from GET /api/v1/agents/{agent_id}/config
type AgentInfo ¶
type AgentInfo struct {
AgentID string `json:"agent_id"`
Hostname string `json:"hostname"`
Status string `json:"status"`
OS string `json:"os"`
Arch string `json:"arch"`
NetworkIPs []string `json:"network_ips,omitempty"`
GPUs []GPUInfo `json:"gpus,omitempty"`
Workers []WorkerInfo `json:"workers,omitempty"`
GPUCount int `json:"gpu_count,omitempty"`
GPUSummary string `json:"gpu_summary,omitempty"`
LastSeenAt time.Time `json:"last_seen_at"`
CreatedAt time.Time `json:"created_at"`
}
AgentInfo represents agent information
type AgentListResponse ¶
type AgentListResponse struct {
Agents []AgentInfo `json:"agents"`
}
AgentListResponse represents the response from GET /api/v1/agents
type AgentMetricsRequest ¶
type AgentMetricsRequest struct {
Timestamp time.Time `json:"timestamp"`
System SystemMetrics `json:"system"`
GPUs []GPUMetrics `json:"gpus"`
}
AgentMetricsRequest represents the request body for agent metrics report
type AgentRegisterRequest ¶
type AgentRegisterRequest struct {
Token string `json:"token"`
Hostname string `json:"hostname"`
OS string `json:"os"`
Arch string `json:"arch"`
GPUs []GPUInfo `json:"gpus"`
NetworkIPs []string `json:"network_ips"`
}
AgentRegisterRequest represents the request body for agent registration
type AgentRegisterResponse ¶
type AgentRegisterResponse struct {
AgentID string `json:"agent_id"`
AgentSecret string `json:"agent_secret"`
License License `json:"license"`
}
AgentRegisterResponse represents the response from agent registration
type AgentStatusEvent ¶
type AgentStatusEvent string
AgentStatusEvent represents special events in status report
const ( // AgentStatusEventShutdown indicates the agent is shutting down AgentStatusEventShutdown AgentStatusEvent = "shutdown" )
type AgentStatusRequest ¶
type AgentStatusRequest struct {
Timestamp time.Time `json:"timestamp"`
GPUs []GPUStatus `json:"gpus"`
Workers []WorkerStatus `json:"workers"`
Event AgentStatusEvent `json:"event,omitempty"`
// License optimization - client reports current license expiration
// Server only regenerates if < 10 minutes remaining
LicenseExpiration *int64 `json:"license_expiration,omitempty"` // Unix timestamp in milliseconds
// Metrics contains InfluxDB v2 line protocol string with GPU/system/worker metrics
// Forwarded by the backend to GreptimeDB for time-series storage
Metrics string `json:"metrics,omitempty"`
}
AgentStatusRequest represents the request body for agent status report
type AgentStatusResponse ¶
type AgentStatusResponse struct {
Success bool `json:"success"`
ConfigVersion int `json:"config_version"`
License *License `json:"license,omitempty"` // null if no regeneration needed
}
AgentStatusResponse represents the response from agent status report
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the HTTP client for GPU Go API
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
NewClient creates a new API client The base URL defaults to GPU_GO_ENDPOINT env var if set, otherwise https://tensor-fusion.ai
func (*Client) CreateShare ¶
CreateShare creates a new share link
func (*Client) CreateWorker ¶
func (c *Client) CreateWorker(ctx context.Context, req *WorkerCreateRequest) (*WorkerInfo, error)
CreateWorker creates a new worker
func (*Client) DeleteAgent ¶
DeleteAgent deletes an agent
func (*Client) DeleteShare ¶
DeleteShare deletes a share
func (*Client) DeleteWorker ¶
DeleteWorker deletes a worker
func (*Client) GenerateToken ¶
GenerateToken generates a temporary installation token
func (*Client) GetAgentConfig ¶
GetAgentConfig gets the agent configuration
func (*Client) GetBaseURL ¶
GetBaseURL returns the base URL for the client
func (*Client) GetReleases ¶
func (c *Client) GetReleases(ctx context.Context, vendor string, size int) (*ReleasesResponse, error)
GetReleases fetches middleware releases from the ecosystem API vendor: optional vendor slug (e.g., "nvidia") size: optional number of results (default: 10, max: 500)
func (*Client) GetSharePublic ¶
GetSharePublic gets public share information by short code
func (*Client) ListAgents ¶
func (c *Client) ListAgents(ctx context.Context) (*AgentListResponse, error)
ListAgents lists all agents for the current user
func (*Client) ListShares ¶
func (c *Client) ListShares(ctx context.Context) (*ShareListResponse, error)
ListShares lists all shares for the current user
func (*Client) ListWorkers ¶
func (c *Client) ListWorkers(ctx context.Context, agentID, hostname string) (*WorkerListResponse, error)
ListWorkers lists all workers for the current user
func (*Client) RegisterAgent ¶
func (c *Client) RegisterAgent(ctx context.Context, tempToken string, req *AgentRegisterRequest) (*AgentRegisterResponse, error)
RegisterAgent registers an agent with the server
func (*Client) ReportAgentMetrics ¶
func (c *Client) ReportAgentMetrics(ctx context.Context, agentID string, req *AgentMetricsRequest) error
ReportAgentMetrics reports the agent metrics to the server
func (*Client) ReportAgentStatus ¶
func (c *Client) ReportAgentStatus(ctx context.Context, agentID string, req *AgentStatusRequest) (*AgentStatusResponse, error)
ReportAgentStatus reports the agent status to the server and returns the response
func (*Client) SetAgentSecret ¶
SetAgentSecret sets the agent secret for authentication
func (*Client) SetBaseURL ¶
SetBaseURL sets the base URL for the client
func (*Client) SetUserToken ¶
SetUserToken sets the user token for authentication
func (*Client) UpdateWorker ¶
func (c *Client) UpdateWorker(ctx context.Context, workerID string, req *WorkerUpdateRequest) (*WorkerInfo, error)
UpdateWorker updates a worker
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function that configures the client
func WithAgentSecret ¶
func WithAgentSecret(secret string) ClientOption
WithAgentSecret sets the agent secret for authentication
func WithBaseURL ¶
func WithBaseURL(url string) ClientOption
WithBaseURL sets the base URL for the client
func WithHTTPClient ¶
func WithHTTPClient(httpClient *resty.Client) ClientOption
WithHTTPClient sets a custom HTTP client
func WithUserToken ¶
func WithUserToken(token string) ClientOption
WithUserToken sets the user token for authentication
type ConnectionInfo ¶
type ConnectionInfo struct {
ClientIP string `json:"client_ip"`
ConnectedAt time.Time `json:"connected_at"`
}
ConnectionInfo represents client connection information
type GPUInfo ¶
type GPUInfo struct {
GPUID string `json:"gpu_id"`
GPUIndex int `json:"gpu_index"`
Vendor string `json:"vendor"`
Model string `json:"model"`
VRAMMb int64 `json:"vram_mb"`
DriverVersion string `json:"driver_version,omitempty"`
CUDAVersion string `json:"cuda_version,omitempty"`
}
GPUInfo represents GPU information for agent registration
type GPUMetrics ¶
type GPUMetrics struct {
GPUID string `json:"gpu_id"`
Utilization float64 `json:"utilization"`
VRAMUsedMb int64 `json:"vram_used_mb"`
VRAMTotalMb int64 `json:"vram_total_mb"`
Temperature float64 `json:"temperature"`
PowerUsageW float64 `json:"power_usage_w"`
PCIeRxKB float64 `json:"pcie_rx_kb"`
PCIeTxKB float64 `json:"pcie_tx_kb"`
}
GPUMetrics represents GPU metrics for metrics report
type GPUStatus ¶
type GPUStatus struct {
GPUID string `json:"gpu_id"`
GPUIndex int `json:"gpu_index"`
UsedByWorker *string `json:"used_by_worker"`
Vendor string `json:"vendor"`
Model string `json:"model"`
VRAMMb int64 `json:"vram_mb"`
DriverVersion string `json:"driver_version,omitempty"`
CUDAVersion string `json:"cuda_version,omitempty"`
GPUChanged bool `json:"gpu_changed,omitempty"`
}
GPUStatus represents GPU status for status report
type HeartbeatResponse ¶
type HeartbeatResponse struct {
ConfigVersion int `json:"config_version"`
}
HeartbeatResponse represents the response from WebSocket heartbeat
type IsolationModeType ¶
type IsolationModeType = string
IsolationModeType mirrors tensor-fusion's IsolationModeType
const ( IsolationModeSoft IsolationModeType = "soft" IsolationModePartitioned IsolationModeType = "partitioned" )
Isolation mode constants - use utils.IsolationMode* for canonical values
func ToIsolationMode ¶
func ToIsolationMode(s string) IsolationModeType
ToIsolationMode converts a string to IsolationModeType Deprecated: Use utils.ToTFIsolationMode for tensor-fusion types
type ReleaseArtifact ¶
type ReleaseArtifact struct {
CPUArch string `json:"cpuArch"`
OS string `json:"os"`
URL string `json:"url"`
SHA256 string `json:"sha256"`
Metadata map[string]string `json:"metadata,omitempty"`
}
ReleaseArtifact represents a downloadable artifact for a release
type ReleaseInfo ¶
type ReleaseInfo struct {
ID string `json:"id"`
Vendor VendorInfo `json:"vendor"`
Version string `json:"version"`
ReleaseType string `json:"releaseType"`
ReleaseDate time.Time `json:"releaseDate"`
Artifacts []ReleaseArtifact `json:"artifacts"`
Requirements ReleaseRequirements `json:"requirements"`
IsLatest bool `json:"isLatest"`
}
ReleaseInfo represents a middleware release from the API
type ReleaseRequirements ¶
type ReleaseRequirements struct {
MinTensorFusionVersion string `json:"minTensorFusionVersion,omitempty"`
MinDriverVersion string `json:"minDriverVersion,omitempty"`
}
ReleaseRequirements represents version requirements for a release
type ReleasesResponse ¶
type ReleasesResponse struct {
Releases []ReleaseInfo `json:"releases"`
Count int `json:"count"`
}
ReleasesResponse represents the response from GET /api/ecosystem/releases
type ShareCreateRequest ¶
type ShareCreateRequest struct {
}
ShareCreateRequest represents the request body for share creation
type ShareListResponse ¶
type ShareListResponse struct {
}
ShareListResponse represents the response from GET /api/v1/shares
type SharePublicInfo ¶
type SharePublicInfo struct {
}
SharePublicInfo represents public share information
type SuccessResponse ¶
type SuccessResponse struct {
Success bool `json:"success"`
}
SuccessResponse represents a simple success response
type SystemMetrics ¶
type SystemMetrics struct {
CPUUsage float64 `json:"cpu_usage"`
MemoryUsedMb int64 `json:"memory_used_mb"`
MemoryTotalMb int64 `json:"memory_total_mb"`
}
SystemMetrics represents system metrics for metrics report
type TokenResponse ¶
type TokenResponse struct {
Token string `json:"token"`
ExpiresAt time.Time `json:"expires_at"`
InstallCommand string `json:"install_command"`
}
TokenResponse represents the response from POST /api/v1/tokens/generate
type VendorInfo ¶
VendorInfo represents vendor information in a release
type WorkerConfig ¶
type WorkerConfig struct {
WorkerID string `json:"worker_id"`
GPUIDs []string `json:"gpu_ids"`
GPUIndices []int `json:"gpu_indices,omitempty"`
VRAMMb int64 `json:"vram_mb,omitempty"`
ComputePercent int `json:"compute_percent,omitempty"`
IsolationMode string `json:"isolation_mode,omitempty"`
ListenPort int `json:"listen_port"`
Enabled bool `json:"enabled"`
}
WorkerConfig represents worker configuration from server
type WorkerCreateRequest ¶
type WorkerCreateRequest struct {
AgentID string `json:"agent_id"`
Name string `json:"name"`
GPUIDs []string `json:"gpu_ids"`
ListenPort int `json:"listen_port"`
Enabled bool `json:"enabled"`
}
WorkerCreateRequest represents the request body for worker creation
type WorkerInfo ¶
type WorkerInfo struct {
WorkerID string `json:"worker_id"`
AgentID string `json:"agent_id,omitempty"`
AgentHostname string `json:"agent_hostname,omitempty"`
Name string `json:"name"`
GPUIDs []string `json:"gpu_ids"`
GPUIndices []int `json:"gpu_indices,omitempty"`
GPUs []GPUInfo `json:"gpus,omitempty"`
ListenPort int `json:"listen_port"`
Enabled bool `json:"enabled"`
IsDefault bool `json:"is_default,omitempty"`
Status string `json:"status"`
PID int `json:"pid,omitempty"`
Restarts int `json:"restarts,omitempty"`
Connections []ConnectionInfo `json:"connections,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
WorkerInfo represents worker information
type WorkerListResponse ¶
type WorkerListResponse struct {
Workers []WorkerInfo `json:"workers"`
}
WorkerListResponse represents the response from GET /api/v1/workers
type WorkerStatus ¶
type WorkerStatus struct {
WorkerID string `json:"worker_id"`
Status string `json:"status"`
PID int `json:"pid,omitempty"`
Restarts int `json:"restarts,omitempty"`
GPUIDs []string `json:"gpu_ids"`
GPUIndices []int `json:"gpu_indices,omitempty"`
Connections []ConnectionInfo `json:"connections,omitempty"`
// Optimization flags - only update DB when these are true
WorkerChanged *bool `json:"worker_changed,omitempty"` // true if status/pid/restarts/gpu_ids changed
ConnectionChanged *bool `json:"connection_changed,omitempty"` // true if connections changed
GPUChanged *bool `json:"gpu_changed,omitempty"` // true if vendor/model/vram/driver/cuda changed
}
WorkerStatus represents worker status for status report