config

package
v0.1.2-alpha Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() (string, error)

DefaultConfigPath returns ~/.config/hpcc/config.toml on Unix and the platform equivalent elsewhere.

func ParseSize

func ParseSize(s string) (int64, error)

ParseSize converts a human-readable size string (e.g. "10G", "500MB", "1.5GiB" — actually no, integer only — "1024K", "4096") into bytes. Suffixes are case-insensitive; whitespace between number and suffix is allowed. A plain number is bytes. An empty string returns 0, which the cache layer interprets as "unlimited."

All multipliers are binary (1024-based), including KB/MB/GB/TB. If you need strict-decimal SI semantics you'll have to ask for them separately; nobody asks the size of their RAM stick in base 10.

Types

type CacheConfig

type CacheConfig struct {
	Type enum.CacheType `toml:"type"`

	// Disk-specific fields.
	Location string `toml:"location,omitempty"`
	MaxSize  string `toml:"max_size,omitempty"`

	// S3-specific fields.
	Bucket    string `toml:"bucket,omitempty"`
	Region    string `toml:"region,omitempty"`
	Endpoint  string `toml:"endpoint,omitempty"`
	AccessKey string `toml:"access_key,omitempty"`
	SecretKey string `toml:"secret_key,omitempty"`

	// AutoCreate, when true, has the worker attempt CreateBucket if
	// the bucket isn't reachable at startup. Only sane for local
	// MinIO/dev setups — in production the bucket is provisioned by
	// infra and the worker shouldn't even hold CreateBucket IAM
	// permissions. Default false.
	AutoCreate bool `toml:"auto_create,omitempty"`
}

CacheConfig describes a single cache backend. The Type field selects which backend is used; the remaining fields are type-specific (only the fields relevant to the chosen type need to be set).

TOML example (multiple caches):

[[cache]]
type     = "disk"
location = "/tmp/hpcc"
max_size = "10G"

[[cache]]
type     = "disk"
location = "/mnt/fast/hpcc"
max_size = "50G"

type Config

type Config struct {
	// SourceMode picks both the local cache-key derivation and the
	// dispatch wire format. The two have to track the same value so
	// client and worker compute matching keys for shared caches —
	// see enum.SourceMode for the full story.
	SourceMode enum.SourceMode `toml:"source_mode"`
	Caches     []CacheConfig   `toml:"cache"`
	Remote     RemoteConfig    `toml:"remote"`
}

Config is the on-disk configuration shape. TOML keys are snake_case; Go fields use the standard tag.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the values used when no config file is present.

func LoadConfig

func LoadConfig(path string) (Config, error)

LoadConfig reads a TOML config from path. A missing file is not an error — it returns DefaultConfig. A malformed file IS an error; the user should know their config is being ignored.

type RemoteConfig

type RemoteConfig struct {
	Enabled     bool            `toml:"enabled"`
	TenantID    string          `toml:"tenant_id"`
	ImageRef    string          `toml:"image_ref"`
	ImageDigest string          `toml:"image_digest"`
	Scheduler   SchedulerConfig `toml:"scheduler"`
}

RemoteConfig drives the daemon's distributed-compile path. When Enabled is false (the default) the daemon stays local. When true, each compile request is routed through the scheduler to a worker; failures fall back to local execution with a warning.

SourceMode lives on the parent Config, not here — it drives the local cache key too, not just dispatch, and a daemon with no [remote] block still needs a value for its cache key.

OAuth credentials are NOT in this struct: `hpcc auth login` writes them to a sibling token.json (0600). The daemon reads from there and refreshes silently when the access token expires.

type SchedulerConfig

type SchedulerConfig struct {
	URL    string `toml:"url"`
	CAFile string `toml:"ca_file"`
}

SchedulerConfig is the dial info for the scheduler gRPC endpoint. CAFile is optional — if empty, the system trust store is used.

Jump to

Keyboard shortcuts

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