daemonsubsystem

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropNode

func DropNode(nodename string)

func InitData

func InitData()

InitData reset package daemondef data, it can be used for tests.

func PeerURL

func PeerURL(nodename string) string

Types

type Alert

type Alert struct {
	Message  string `json:"message"`
	Severity string `json:"severity"`
}

Alert describes a message with a severity

type CacheData

type CacheData[T Cacher] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CacheData defines a shared holder for all nodes Cacher

var (

	// DataCollector is the package data holder for all nodes Collector
	DataCollector *CacheData[Collector]

	// DataDns is the package data holder for all nodes Dns
	DataDns *CacheData[Dns]

	// DataDaemondata is the package data holder for all nodes Daemondata
	DataDaemondata *CacheData[Daemondata]

	// DataHeartbeat is the package data holder for all nodes Heartbeat
	DataHeartbeat *CacheData[Heartbeat]

	// DataListener is the package data holder for all nodes Listener
	DataListener *CacheData[Listener]

	// DataListener is the package data holder for all nodes RunnerImon
	DataRunnerImon *CacheData[RunnerImon]

	// DataScheduler is the package data holder for all nodes Scheduler
	DataScheduler *CacheData[Scheduler]
)

func NewData

func NewData[T Cacher]() *CacheData[T]

func (*CacheData[T]) Get

func (c *CacheData[T]) Get(nodename string) *T

Get return the stored value for nodename or nil if not found

func (*CacheData[T]) GetAll

func (c *CacheData[T]) GetAll() []CacheElement[T]

GetAll returns all stored elements as list of CacheElement[T]

func (*CacheData[T]) Set

func (c *CacheData[T]) Set(nodename string, v *T)

Set add or update v for nodename

func (*CacheData[T]) Unset

func (c *CacheData[T]) Unset(nodename string)

Unset existing stored value for nodename

type CacheElement

type CacheElement[T Cacher] struct {
	Node  string
	Value *T
}

type Cacher

type Cacher interface {
	Collector | Dns | Daemondata | Heartbeat | Listener | RunnerImon | Scheduler
}

type Collector

type Collector struct {
	Status

	Url string `json:"url"`

	// Speaker is the node the collector of the node takes for the
	// speaker, as one it waits for, away: a node restarting takes the
	// speech back only while its peers wait for it.
	Speaker string `json:"speaker,omitempty"`
}

Collector describes the daemon collector subsystem.

func (*Collector) DeepCopy

func (c *Collector) DeepCopy() *Collector

type Daemon

type Daemon struct {
	// Collector DaemonCollector describes the OpenSVC daemon collector subsystem state,
	// which is responsible for communicating with the collector on behalf
	// of the cluster. Only one node on the cluster is the collector speaker
	Collector Collector `json:"collector"`

	// Daemondata DaemonDaemondata describes the OpenSVC daemon data subsystem state,
	// which is responsible for aggregating data messages and selecting
	// candidate data messages to forward to peer nodes.
	Daemondata Daemondata `json:"daemondata"`

	// Dns describes the OpenSVC daemon dns subsystem state, which is
	// responsible for janitoring and serving the cluster Dns zone.
	// This zone is dynamically populated by ip address allocated for the
	// services (frontend and backend).
	Dns Dns `json:"dns"`

	Heartbeat Heartbeat `json:"heartbeat"`

	// Listener DaemonListener describes the OpenSVC daemon listener subsystem state,
	// which is responsible for serving the API.
	Listener Listener `json:"listener"`

	Nodename string `json:"nodename"`

	// Pid the main daemon process id
	// it is sent on the full hb message, then not anymore changed
	Pid int `json:"pid"`

	// StartedAt is the time when daemon has been started
	// it is sent on the full hb message, then not anymore changed
	StartedAt time.Time `json:"started_at"`

	RunnerImon RunnerImon `json:"runner_imon"`

	// Scheduler DaemonScheduler describes the OpenSVC daemon scheduler subsystem state,
	// which is responsible for executing node and objects scheduled jobs.
	Scheduler Scheduler `json:"scheduler"`
}

Daemon defines model for Daemon.

func (*Daemon) DeepCopy

func (d *Daemon) DeepCopy() *Daemon

DeepCopy returns a copy of the daemon state sharing nothing with it.

It copies the struct first and deepens the members after, rather than listing the fields it wants: enumerating them silently dropped Nodename here, and SecretVersion and UpdatedAt in Heartbeat, until a real clusterdump.Data.DeepCopy started routing through these methods.

type DaemonLocal

type DaemonLocal struct {
	// Nodename is used to identify the nodename that have sent Daemon struct
	Nodename string `json:"nodename"`
	Routines int    `json:"routines"`
}

DaemonLocal defines model for DaemonLocal data that are not sent to peers.

type Daemondata

type Daemondata struct {
	Status

	// QueueSize the subscription queue size
	QueueSize int `json:"queue_size"`
}

Daemondata defines model for Daemondata.

func (*Daemondata) DeepCopy

func (c *Daemondata) DeepCopy() *Daemondata

type Dns

type Dns struct {
	Status

	// Nameservers list of nameservers
	Nameservers []string `json:"nameservers"`
}

Dns defines model for Dns daemon subsystem.

func (*Dns) DeepCopy

func (c *Dns) DeepCopy() *Dns

DeepCopy returns a copy of the dns state sharing nothing with it. Nameservers comes out non-nil, see Heartbeat.DeepCopy.

type Heartbeat

type Heartbeat struct {

	// LastMessages is the last messages details received from  cluster
	// peer nodes plus the last message details localhost has sent.
	LastMessages []HeartbeatLastMessage `json:"last_messages"`

	// LastMessage is the last message sent from localhost
	LastMessage HeartbeatLastMessage `json:"last_message"`

	// Streams list of daemon heartbeat streams
	Streams []HeartbeatStream `json:"streams"`

	SecretVersion struct {
		Main      uint64 `json:"main"`
		Alternate uint64 `json:"alt"`
	} `json:"secret_version"`

	UpdatedAt time.Time `json:"updated_at"`
}

Heartbeat defines model for Daemon Heartbeat subsystem.

func (*Heartbeat) DeepCopy

func (c *Heartbeat) DeepCopy() *Heartbeat

DeepCopy returns a copy of the heartbeat state sharing nothing with it.

The collections come out non-nil even when they went in nil, which is not what a copy would normally do. It is deliberate: this is the daemon's publication path, none of these fields carry omitempty, and a nil serializes as null where an empty one serializes as []. hbctrl builds Alerts with append to a nil slice, so an alert-free stream arrives here nil and would reach an api client as null without this. TestDeepCopyKeepsCollectionsNonNil pins it.

func (*Heartbeat) Table

func (c *Heartbeat) Table(nodeName string, isSingleNode bool) HeartbeatStreamPeerStatusTable

type HeartbeatLastMessage

type HeartbeatLastMessage struct {
	// From a cluster node
	From string `json:"from"`

	// PatchLength the patch queue length when type is patch, else it is 0
	PatchLength int `json:"patch_length"`

	// Type the heartbeat message type used by node
	Type string `json:"type"`
}

type HeartbeatStream

type HeartbeatStream struct {
	Status

	// Type of heartbeat stream (unicast, multicast, ...)
	Type string `json:"type"`

	// Peers map of peer names to daemon hb stream peer status
	Peers map[string]HeartbeatStreamPeerStatus `json:"peers"`

	Alerts []Alert `json:"alerts"`
}

HeartbeatStream defines model for Heartbeat Stream (a sending or receiving heartbeat).

  • a sending daemon heartbeat is responsible for sending node dataset changes to peers
  • a receiving daemon heartbeat is responsible for receiving node dataset changes from peers

func (*HeartbeatStream) DeepCopy

func (c *HeartbeatStream) DeepCopy() *HeartbeatStream

DeepCopy returns a copy of the stream state sharing nothing with it. Its collections come out non-nil, see Heartbeat.DeepCopy.

type HeartbeatStreamPeerStatus

type HeartbeatStreamPeerStatus struct {
	Desc      string `json:"desc"`
	IsBeating bool   `json:"is_beating"`

	// ChangedAt is the time of IsBeating value changed
	ChangedAt time.Time `json:"changed_at"`

	// LastBeatingAt is the last beating time
	LastBeatingAt time.Time `json:"last_beating_at"`
}

HeartbeatStreamPeerStatus status of the communication with a specific peer node.

type HeartbeatStreamPeerStatusTable

type HeartbeatStreamPeerStatusTable []HeartbeatStreamPeerStatusTableEntry

type HeartbeatStreamPeerStatusTableEntry

type HeartbeatStreamPeerStatusTableEntry struct {
	Node string `json:"node"`
	Peer string `json:"peer"`
	Status
	Type   string  `json:"type"`
	Alerts []Alert `json:"alerts"`
	HeartbeatStreamPeerStatus
	IsSingleNode bool `json:"-"`
}

func (HeartbeatStreamPeerStatusTableEntry) Unstructured

func (t HeartbeatStreamPeerStatusTableEntry) Unstructured() map[string]any

Unstructured returns the entry as the tab renderer reads it, which is values and the words standing for them.

The icons a listing draws the state and the beating flag as are not here: they are escape sequences, and this type is published by the daemon and read by the tui, which paints its own cells from these values.

type Listener

type Listener struct {
	Status

	Addr string `json:"addr"`

	Port string `json:"port"`

	RateLimiter cluster.RateLimiterConfig `json:"rate_limiter"`
}

Listener defines daemon Listener subsystem state.

func (*Listener) DeepCopy

func (c *Listener) DeepCopy() *Listener

type RunnerImon

type RunnerImon struct {
	Status

	MaxRunning int `json:"max_running"`
}

RunnerImon defines the daemon runner for imon subsystem.

func (*RunnerImon) DeepCopy

func (c *RunnerImon) DeepCopy() *RunnerImon

type Scheduler

type Scheduler struct {
	Status

	// Count is the number of defined scheduled jobs
	Count int `json:"count"`

	// MaxRunning is the maximum number of running jobs
	MaxRunning int `json:"max_running"`
}

Scheduler defines model for daemon scheduler subsystem.

func (*Scheduler) DeepCopy

func (d *Scheduler) DeepCopy() *Scheduler

type Status

type Status struct {
	ID string `json:"id"`

	State string `json:"state"`

	ConfiguredAt time.Time `json:"configured_at"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

Status describes a OpenSVC daemon subsystem: when it was last created, configured an updated, what its current state is and its id.

Jump to

Keyboard shortcuts

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