daemon

package
v0.0.0-...-4957362 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	Verbose bool
	Debug   bool

	// Consumers of MicroCluster are required to provide a version to serve at /cluster/1.0.
	Version string

	// Name of the Unix group of the control socket
	SocketGroup string

	// Address/port to offer the core API and extension servers over before initializing the daemon
	PreInitListenAddress string

	// How often heartbeats are attempted
	HeartbeatInterval time.Duration

	// List of schema updates in the order that they should be applied.
	ExtensionsSchema []schema.Update

	// List of extensions supported by the endpoints of the core/default cluster API.
	APIExtensions []string

	// Functions that trigger at various lifecycle events
	Hooks *state.Hooks

	// Each rest.Server will be initialized and managed by microcluster.
	ExtensionServers map[string]rest.Server
}

Args are the data needed to start a MicroCluster daemon.

type Daemon

type Daemon struct {
	ReadyChan chan struct{} // Closed when the daemon is fully ready.

	Extensions extensions.Extensions // Extensions supported at runtime by the daemon.
	// contains filtered or unexported fields
}

Daemon holds information for the microcluster daemon.

func NewDaemon

func NewDaemon(project string) *Daemon

NewDaemon initializes the Daemon context and channels.

func (*Daemon) Address

func (d *Daemon) Address() *api.URL

Address is the listen address for the daemon.

func (*Daemon) ClusterCert

func (d *Daemon) ClusterCert() *shared.CertInfo

ClusterCert ensures both the daemon and state have the same cluster cert.

func (*Daemon) ExtensionServers

func (d *Daemon) ExtensionServers() []string

ExtensionServers returns an immutable list of the daemon's additional listeners. Only the listeners which can be modified are returned. The listeners which are part of the core API are excluded.

func (*Daemon) FileSystem

func (d *Daemon) FileSystem() *sys.OS

FileSystem returns the filesystem structure for the daemon.

func (*Daemon) LocalConfig

func (d *Daemon) LocalConfig() *internalConfig.DaemonConfig

LocalConfig returns the daemon's internal config implementation. It is thread safe and can be used to both read and write config.

func (*Daemon) Name

func (d *Daemon) Name() string

Name is this daemon's cluster member name.

func (*Daemon) ReloadCert

func (d *Daemon) ReloadCert(name types.CertificateName) error

ReloadCert reloads a specific certificate from the filesytem.

func (*Daemon) Run

func (d *Daemon) Run(ctx context.Context, stateDir string, args Args) error

Run initializes the Daemon with the given configuration, starts the database, and blocks until the daemon is cancelled.

func (*Daemon) ServerCert

func (d *Daemon) ServerCert() *shared.CertInfo

ServerCert ensures both the daemon and state have the same server cert.

func (*Daemon) StartAPI

func (d *Daemon) StartAPI(ctx context.Context, bootstrap bool, initConfig map[string]string, newConfig *trust.Location, joinAddresses ...string) error

StartAPI starts up the admin and consumer APIs, and generates a cluster cert if we are bootstrapping the first node.

func (*Daemon) State

func (d *Daemon) State() state.State

State creates a State instance with the daemon's stateful components.

func (*Daemon) UpdateServers

func (d *Daemon) UpdateServers() error

UpdateServers updates and start/stops the additional listeners.

func (*Daemon) Version

func (d *Daemon) Version() string

Version is provided by the MicroCluster consumer. The daemon includes it in its /cluster/1.0 response.

Jump to

Keyboard shortcuts

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