daemonsubsystem

package
v0.0.0-...-ffd2651 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

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.

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"`
}

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

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

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"`

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

Heartbeat defines model for Daemon Heartbeat subsystem.

func (*Heartbeat) DeepCopy

func (c *Heartbeat) DeepCopy() *Heartbeat

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

type HeartbeatStreamPeerStatus

type HeartbeatStreamPeerStatus struct {
	IsBeating bool      `json:"is_beating"`
	LastAt    time.Time `json:"last_at"`
}

HeartbeatStreamPeerStatus status of the communication with a specific peer node.

type Listener

type Listener struct {
	Status

	Addr string `json:"addr"`

	Port string `json:"port"`
}

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