Documentation
¶
Index ¶
- Variables
- type Config
- type GPUConfig
- type Manager
- func (m *Manager) ConfigExists() bool
- func (m *Manager) ConfigPath() string
- func (m *Manager) EnsureDirs() error
- func (m *Manager) GPUsPath() string
- func (m *Manager) GetConfigVersion() (int, error)
- func (m *Manager) IsRegistered() (bool, error)
- func (m *Manager) LoadConfig() (*Config, error)
- func (m *Manager) LoadGPUs() ([]GPUConfig, error)
- func (m *Manager) LoadWorkers() ([]WorkerConfig, error)
- func (m *Manager) RemoveConfig() error
- func (m *Manager) SaveConfig(cfg *Config) error
- func (m *Manager) SaveGPUs(gpus []GPUConfig) error
- func (m *Manager) SaveWorkers(workers []WorkerConfig) error
- func (m *Manager) StateDir() string
- func (m *Manager) UpdateConfigVersion(version int, license api.License) error
- func (m *Manager) WorkersPath() string
- type WorkerConfig
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultPaths provides platform-specific default paths DefaultPaths = platform.DefaultPaths() )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ConfigVersion int `json:"config_version"`
AgentID string `json:"agent_id"`
AgentSecret string `json:"agent_secret"`
ServerURL string `json:"server_url"`
License api.License `json:"license"`
}
Config represents the agent configuration
type GPUConfig ¶
type GPUConfig struct {
GPUID string `json:"gpu_id"`
GPUIndex int `json:"gpu_index"`
Vendor string `json:"vendor"`
Model string `json:"model"`
VRAMMb int64 `json:"vram_mb"`
UsedByWorker *string `json:"used_by_worker"`
}
GPUConfig represents GPU configuration
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages configuration files
func NewManager ¶
NewManager creates a new configuration manager
func NewManagerWithPaths ¶
NewManagerWithPaths creates a new configuration manager from platform paths
func (*Manager) ConfigExists ¶
ConfigExists checks if config file exists
func (*Manager) ConfigPath ¶
ConfigPath returns the path to the config file
func (*Manager) EnsureDirs ¶
EnsureDirs ensures configuration directories exist
func (*Manager) GetConfigVersion ¶
GetConfigVersion returns the current config version
func (*Manager) IsRegistered ¶ added in v1.1.21
IsRegistered returns true when the config indicates an existing registration.
func (*Manager) LoadConfig ¶
LoadConfig loads the agent configuration
func (*Manager) LoadWorkers ¶
func (m *Manager) LoadWorkers() ([]WorkerConfig, error)
LoadWorkers loads worker configurations
func (*Manager) RemoveConfig ¶ added in v1.6.0
RemoveConfig removes local agent configuration files (config, gpus, workers). After this call IsRegistered returns false. The config directory itself is left in place so that the caller (e.g. an uninstall script) can remove it.
func (*Manager) SaveConfig ¶
SaveConfig saves the agent configuration
func (*Manager) SaveWorkers ¶
func (m *Manager) SaveWorkers(workers []WorkerConfig) error
SaveWorkers saves worker configurations
func (*Manager) UpdateConfigVersion ¶
UpdateConfigVersion updates the config version and license
func (*Manager) WorkersPath ¶
WorkersPath returns the path to the workers file
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"`
ListenPort int `json:"listen_port"`
Enabled bool `json:"enabled"`
PID int `json:"pid,omitempty"`
Status string `json:"status,omitempty"`
Connections []api.ConnectionInfo `json:"connections,omitempty"`
}
WorkerConfig represents worker configuration with runtime state