state

package
v0.0.0-...-526a3b6 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OnHeartbeatHook func(state *State) error

OnHeartbeatHook is a post-action hook that is run on the leader after a successful heartbeat round.

View Source
var OnNewMemberHook func(state *State) error

OnNewMemberHook is a post-action hook that is run on all cluster members when a new cluster member joins the cluster.

View Source
var PostRemoveHook func(state *State, force bool) error

PostRemoveHook is a post-action hook that is run on all cluster members when a cluster member is removed.

View Source
var PreRemoveHook func(state *State, force bool) error

PreRemoveHook is a post-action hook that is run on a cluster member just before it is is removed.

View Source
var ReloadClusterCert func() error

ReloadClusterCert reloads the cluster keypair from the state directory.

View Source
var StopListeners func() error

StopListeners stops the network listeners and the fsnotify listener.

Functions

This section is empty.

Types

type State

type State struct {
	// Context.
	Context context.Context

	// Ready channel.
	ReadyCh chan struct{}

	// ShutdownDoneCh receives the result of the d.Stop() function and tells the daemon to end.
	ShutdownDoneCh chan error

	// File structure.
	OS *sys.OS

	// Listen Address.
	Address func() *api.URL

	// Name of the cluster member.
	Name func() string

	// Server.
	Endpoints *endpoints.Endpoints

	// Server certificate is used for server-to-server connection.
	ServerCert func() *shared.CertInfo

	// Cluster certificate is used for downstream connections within a cluster.
	ClusterCert func() *shared.CertInfo

	// Database.
	Database *db.DB

	// Remotes.
	Remotes func() *trust.Remotes

	// Initialize APIs and bootstrap/join database.
	StartAPI func(bootstrap bool, initConfig map[string]string, newConfig *trust.Location, joinAddresses ...string) error

	// Stop fully stops the daemon, its database, and all listeners.
	Stop func() (exit func(), stopErr error)

	// Runtime extensions.
	Extensions extensions.Extensions
}

State is a gateway to the stateful components of the microcluster daemon.

func (*State) Cluster

func (s *State) Cluster(isNotification bool) (client.Cluster, error)

Cluster returns a client for every member of a cluster, except this one. All requests made by the client will have the UserAgentNotifier header set if isNotification is true.

func (*State) Leader

func (s *State) Leader() (*client.Client, error)

Leader returns a client connected to the dqlite leader.

Jump to

Keyboard shortcuts

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