config

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 6 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"`
	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) 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) 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"`
	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