profile

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package profile is the server profile: one switch that sets which optional subsystems start.

Index

Constants

View Source
const (
	GuardNodesEnrolled    = "nodes_enrolled"
	GuardPluginsRunning   = "plugins_running"
	GuardRetentionShorter = "retention_shorter"
)

Guard codes returned by Check.

View Source
const (
	SourceEnv     = "env"
	SourceSetting = "setting"
	SourceDefault = "default"
)

Where the effective profile came from.

View Source
const (
	EnvSmallDiskBytes     = "APP_SMALL_DISK_BYTES"
	EnvSmallDiskRetention = "APP_SMALL_DISK_RETENTION"
	EnvMinimalRetention   = "APP_PROFILE_MINIMAL_RETENTION"
	EnvLowRAMBytes        = "APP_LOW_RAM_BYTES"
	EnvLazyStartInterval  = "APP_PROFILE_LAZY_START_INTERVAL"
)

Env knobs for the profile thresholds.

View Source
const EnvVar = "APP_SERVER_PROFILE"

EnvVar pins the profile and wins over the saved choice. APP_PROFILE already names the CLI credentials profile, so the server uses its own variable.

Variables

This section is empty.

Functions

func ActiveSource

func ActiveSource() string

ActiveSource says where the active profile came from.

func Blocked

func Blocked(ps []Problem) bool

Blocked reports whether any problem refuses the move.

func LazyStartInterval

func LazyStartInterval(lookup func(string) (string, bool)) time.Duration

LazyStartInterval is how often a lazily started loop checks whether work appeared.

func Lookup

func Lookup(base func(string) (string, bool), p Profile) func(string) (string, bool)

Lookup wraps an env lookup so profile env defaults answer for unset variables.

func LowRAMBytes

func LowRAMBytes(lookup func(string) (string, bool)) int64

LowRAMBytes is the memory below which an installer recommends the minimal profile.

func NeedsConfirm

func NeedsConfirm(ps []Problem) bool

NeedsConfirm reports whether the move is allowed only with confirm set.

func Retention

func Retention(p Profile, diskBytes int64, lookup func(string) (string, bool)) time.Duration

Retention is the default metrics and log retention: short on minimal, shorter on a small disk, 15 days otherwise. An explicit retention env var still wins at the call site.

func SetActive

func SetActive(p Profile, src string)

SetActive records the profile this process booted with.

Types

type Facts

type Facts struct {
	RemoteNodes    int
	EnabledPlugins int
	// MeshStops is true when the move turns the effective mesh from on to off.
	MeshStops bool
	// Retention is the retention in force now, NewRetention the one the target profile would use.
	Retention    time.Duration
	NewRetention time.Duration
}

Facts is the live state a move is checked against.

type Problem

type Problem struct {
	Code     string `json:"code"`
	Message  string `json:"message"`
	Blocking bool   `json:"blocking"`
}

Problem is one reason a move needs attention. Blocking problems refuse the move; the rest need an explicit confirm because the next sweep deletes rows.

func Check

func Check(from, to Profile, f Facts) []Problem

Check lists what moving from one profile to another would cost. Moving up never has a problem. No move deletes rows itself: gated routes return 404 and loops stop, but a shorter retention is swept at the next pass.

type Profile

type Profile string

Profile names a bundle of defaults for optional subsystems.

const (
	// Minimal is a single node with the optional machinery off.
	Minimal Profile = "minimal"
	// Standard is the default install.
	Standard Profile = "standard"
	// Suite is standard plus mesh, plugins and every experimental feature.
	Suite Profile = "suite"
)

func Active

func Active() Profile

Active returns the profile this process booted with.

func All

func All() []Profile

All returns every profile, lightest first.

func Parse

func Parse(s string) (Profile, bool)

Parse reads a profile name, case and space insensitive.

func Resolve

func Resolve(lookup func(string) (string, bool), saved string) (Profile, string)

Resolve picks the profile: env, then the saved choice, then standard.

func (Profile) Rank

func (p Profile) Rank() int

Rank orders profiles by how much they start, so a move can be called down.

type Settings

type Settings struct {
	Mesh            bool
	Features        []experimental.Feature
	LazyLoops       bool
	LoopbackAgent   bool
	Recommendations bool
	MinRAMBytes     int64
	MinCPUCount     int
	// EnvDefaults are read as if set in the environment when the real variable is unset.
	EnvDefaults map[string]string
}

Settings is what a profile turns on or off by default.

func For

func For(p Profile) Settings

For returns the defaults of p.

Jump to

Keyboard shortcuts

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