nodegroup

package
v1.0.126 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package nodegroup is the node-group definition store: named collections of Data-Plane nodes matched by label selectors (geo-aware grouping, tiered routing, policy scoping), with atomic JSON persistence. It is extracted from package main per ADR-0002; the admin API handlers, the EnrolledNode-typed membership filter, and the globalNodeGroups singleton stay in main (nodegroup.go shim).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelsMatch

func LabelsMatch(selector, labels map[string]string) bool

LabelsMatch returns true when every k/v in selector exists in labels.

Types

type Group

type Group struct {
	Name          string            `json:"name"`
	Description   string            `json:"description,omitempty"`
	LabelSelector map[string]string `json:"label_selector"` // all must match
	Priority      int               `json:"priority,omitempty"`
	CreatedAt     string            `json:"created_at"`
}

Group defines a named collection of Data Plane nodes matched by label selectors. Used for geo-aware grouping, tiered routing, and policy scoping.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store persists node group definitions to a JSON file.

func NewStore

func NewStore(path string) *Store

NewStore loads (or creates) a Store backed by path.

func (*Store) Add

func (s *Store) Add(g Group) (Group, error)

Add validates and appends a new node group.

func (*Store) Delete

func (s *Store) Delete(name string) bool

Delete removes a node group by name. Returns true if found and removed.

func (*Store) Get

func (s *Store) Get(name string) (Group, bool)

Get returns a copy of a named group and true if found.

func (*Store) List

func (s *Store) List() []Group

List returns a copy of all node groups.

func (*Store) MatchingGroups

func (s *Store) MatchingGroups(labels map[string]string) []string

MatchingGroups returns the names of groups whose label selectors are satisfied by the given labels map. A group matches when every key-value pair in its LabelSelector exists in labels.

func (*Store) ReplaceAll

func (s *Store) ReplaceAll(groups []Group)

ReplaceAll atomically replaces all groups (used by config snapshot sync).

func (*Store) Save

func (s *Store) Save()

Save persists the current groups to disk.

Jump to

Keyboard shortcuts

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