Documentation
¶
Index ¶
- type Args
- type Daemon
- func (d *Daemon) Address() *url.URL
- func (d *Daemon) ClusterCert() *shared.CertInfo
- func (d *Daemon) ExtensionServers() []string
- func (d *Daemon) FileSystem() types.OS
- func (d *Daemon) LocalConfig() *internalConfig.DaemonConfig
- func (d *Daemon) Name() string
- func (d *Daemon) ReloadCert(name types.CertificateName) error
- func (d *Daemon) Run(ctx context.Context, stateDir string, args Args) error
- func (d *Daemon) ServerCert() *shared.CertInfo
- func (d *Daemon) StartAPI(ctx context.Context, bootstrap bool, initConfig map[string]string, ...) error
- func (d *Daemon) State() types.State
- func (d *Daemon) UpdateServers() error
- func (d *Daemon) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Args ¶
type Args struct {
// 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 []clusterDB.Update
// List of extensions supported by the endpoints of the core/default cluster API.
APIExtensions []string
// Functions that trigger at various lifecycle events
Hooks *types.Hooks
// Each rest.Server will be initialized and managed by microcluster.
ExtensionServers map[string]types.Server
// DrainConnectionsTimeout is the amount of time to allow for all core server connections to drain when shutting down.
// If it's 0, the connections are not drained when shutting down.
DrainConnectionsTimeout time.Duration
// ShutdownSignals are the signals that will trigger daemon shutdown.
// If nil, default signals (SIGPWR, SIGTERM, SIGINT, SIGQUIT) will be used.
// If set to an empty slice, no signal handling will be performed.
ShutdownSignals []os.Signal
}
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 types.Extensions // Extensions supported at runtime by the daemon.
// contains filtered or unexported fields
}
Daemon holds information for the microcluster daemon.
func (*Daemon) ClusterCert ¶
ClusterCert ensures both the daemon and state have the same cluster cert.
func (*Daemon) ExtensionServers ¶
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 ¶
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) ReloadCert ¶
func (d *Daemon) ReloadCert(name types.CertificateName) error
ReloadCert reloads a specific certificate from the filesytem.
func (*Daemon) Run ¶
Run initializes the Daemon with the given configuration, starts the database, and blocks until the daemon is cancelled.
func (*Daemon) ServerCert ¶
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, 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) UpdateServers ¶
UpdateServers updates and start/stops the additional listeners.