config

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func NewManager(configDir, stateDir string) *Manager

NewManager creates a new configuration manager

func NewManagerWithPaths

func NewManagerWithPaths(paths *platform.Paths) *Manager

NewManagerWithPaths creates a new configuration manager from platform paths

func (*Manager) ConfigExists

func (m *Manager) ConfigExists() bool

ConfigExists checks if config file exists

func (*Manager) ConfigPath

func (m *Manager) ConfigPath() string

ConfigPath returns the path to the config file

func (*Manager) EnsureDirs

func (m *Manager) EnsureDirs() error

EnsureDirs ensures configuration directories exist

func (*Manager) GPUsPath

func (m *Manager) GPUsPath() string

GPUsPath returns the path to the GPUs file

func (*Manager) GetConfigVersion

func (m *Manager) GetConfigVersion() (int, error)

GetConfigVersion returns the current config version

func (*Manager) IsRegistered added in v1.1.21

func (m *Manager) IsRegistered() (bool, error)

IsRegistered returns true when the config indicates an existing registration.

func (*Manager) LoadConfig

func (m *Manager) LoadConfig() (*Config, error)

LoadConfig loads the agent configuration

func (*Manager) LoadGPUs

func (m *Manager) LoadGPUs() ([]GPUConfig, error)

LoadGPUs loads GPU configurations

func (*Manager) LoadWorkers

func (m *Manager) LoadWorkers() ([]WorkerConfig, error)

LoadWorkers loads worker configurations

func (*Manager) RemoveConfig added in v1.6.0

func (m *Manager) RemoveConfig() error

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

func (m *Manager) SaveConfig(cfg *Config) error

SaveConfig saves the agent configuration

func (*Manager) SaveGPUs

func (m *Manager) SaveGPUs(gpus []GPUConfig) error

SaveGPUs saves GPU configurations

func (*Manager) SaveWorkers

func (m *Manager) SaveWorkers(workers []WorkerConfig) error

SaveWorkers saves worker configurations

func (*Manager) StateDir

func (m *Manager) StateDir() string

StateDir returns the state directory

func (*Manager) UpdateConfigVersion

func (m *Manager) UpdateConfigVersion(version int, license api.License) error

UpdateConfigVersion updates the config version and license

func (*Manager) WorkersPath

func (m *Manager) WorkersPath() string

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

Jump to

Keyboard shortcuts

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