fleetversion

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package fleetversion is the pure-domain version model for fleet agent/control-plane version skew (#412, epic #405). It parses and orders "major.minor.patch" versions (an optional leading "v" and any pre-release/build metadata after the numeric core are ignored for ordering — a conservative core-only comparison) and answers "does this version meet a minimum floor". It imports only stdlib.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MeetsFloor

func MeetsFloor(version, floor string) bool

MeetsFloor reports whether version satisfies the minimum floor.

  • An EMPTY floor means "no floor" — always true (the feature is off).
  • An UNPARSEABLE floor is treated as no floor (true): an operator's malformed floor must not brick the whole fleet by refusing every agent; a misconfigured floor is a config problem to surface, not a reason to deny service.
  • A parseable floor with an UNPARSEABLE version FAILS CLOSED (false): under an active floor, an agent that will not state a valid version is treated as below it, not waved through.

Types

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version is a parsed numeric version core (major.minor.patch).

func Parse

func Parse(s string) (Version, bool)

Parse parses "v1.2.3" / "1.2.3" / "1.2" / "1" (missing components default to 0), ignoring any pre-release/build suffix ("-rc1", "+meta"). ok is false when the numeric core is absent or not a non-negative integer triple.

func (Version) Compare

func (v Version) Compare(o Version) int

Compare returns -1 if v < o, 0 if equal, +1 if v > o.

func (Version) Less

func (v Version) Less(o Version) bool

Less reports whether v is strictly older than o.

func (Version) String

func (v Version) String() string

String renders the canonical "major.minor.patch".

Jump to

Keyboard shortcuts

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