schema

package
v0.1.0-proto2f Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentVersion = Version{Major: 1, Minor: 0, Patch: 0}

Current schema version

View Source
var ValidAgentTypes = []string{"service", "timer", "socket", "pipe", "event", "init", "oneshot"}

ValidAgentTypes are the supported agent unit types

Functions

func CheckSchemaVersion

func CheckSchemaVersion(v Version) error

CheckSchemaVersion validates schema version compatibility

func ValidateAgentDescribe

func ValidateAgentDescribe(desc AgentDescribe) error

ValidateAgentDescribe validates agent metadata

func ValidateCPULimit

func ValidateCPULimit(limit string) error

ValidateCPULimit validates CPU limit format Accepts: "0.5", "500m", "1", "1.5"

It does not implement the format. It asks cgroups.ParseResourceSpec - the same function that converts the string for cgroups.Create at start - and accepts exactly what that function can represent as a POSITIVE quantity. Acceptance therefore means the limit will actually be applied, which is a property nothing enforced while the two sides were separate implementations (GAPI-DIV-049).

The cycle noted in ValidateSchedule below is schema -> agentmgr and does not apply here: core/cgroups imports only internal/safeio.

func ValidateMemoryLimit

func ValidateMemoryLimit(limit string) error

ValidateMemoryLimit validates memory limit format Accepts: "100MB", "1GB", "512M", "1G", "1024B"

Delegates to cgroups.ParseResourceSpec for the same reason ValidateCPULimit does: the accepted set and the representable set must be one set. The overflow rejection GAPI-DIV-042 added lives there now, next to the multiplication that overflows.

func ValidateSchedule

func ValidateSchedule(schedule string) error

ValidateSchedule validates systemd-style timer schedule or cron expression Accepts: "OnUnitActiveSec=5s", "OnBootSec=30s", "OnStartupSec=1m", "*/5 * * * *", "@hourly", etc.

Types

type AgentDescribe

type AgentDescribe struct {
	SchemaVersion string
	ID            string
	Type          string
	CPULimit      string
	MemoryLimit   string
	Schedule      string
	ListenStream  string
	Requires      []string
	Wants         []string
	WantedBy      []string
	RequiredBy    []string
	Capabilities  []string
}

AgentDescribe represents agent metadata for validation

type Version

type Version struct {
	Major uint32
	Minor uint32
	Patch uint32
}

Version represents a semantic version

func ParseVersion

func ParseVersion(v string) (Version, error)

ParseVersion parses a version string like "1.0.0"

Jump to

Keyboard shortcuts

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