services

package
v0.0.0-...-d2438c5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusOnline represents a node online
	StatusOnline = "online"
	// StatusOffline represents a node offline
	StatusOffline = "offline"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster interface {
	db.ClusterOpener
	db.ClusterTransactioner
	db.ClusterExclusiveLocker

	// NodeID sets the the node NodeID associated with this cluster instance.
	// It's used for backward-compatibility of all db-related APIs that were
	// written before clustering and don't accept a node NodeID, so in those
	// cases we automatically use this value as implicit node NodeID.
	NodeID(int64)

	// DB returns the underlying db
	DB() database.DB

	// SchemaVersion returns the underlying schema version for the cluster
	SchemaVersion() int

	// Close the database facade.
	Close() error
}

Cluster mediates access to data stored in the cluster dqlite database.

type List

type List struct {
	// contains filtered or unexported fields
}

List the service nodes of the cluster.

func NewList

func NewList(state State, options ...ListOption) *List

NewList creates a List with sane defaults.

func (*List) Run

func (l *List) Run() ([]ServiceMember, error)

Run executes the promote and returns an error if something goes wrong

type ListOption

type ListOption func(*listOptions)

ListOption to be passed to NewList to customize the resulting instance.

func WithClockForList

func WithClockForList(clock clock.Clock) ListOption

WithClockForList sets the clock on the options

func WithLoggerForList

func WithLoggerForList(logger log.Logger) ListOption

WithLoggerForList sets the logger on the options

func WithStateForList

func WithStateForList(state State) ListOption

WithStateForList sets the state on the options

type Node

type Node interface {
	db.NodeTransactioner
}

Node mediates access to the data stored in the node-local SQLite database.

type OS

type OS interface {

	// LocalDatabasePath returns the path of the local database file.
	LocalDatabasePath() string

	// GlobalDatabaseDir returns the path of the global database directory.
	GlobalDatabaseDir() string

	// GlobalDatabasePath returns the path of the global database SQLite file
	// managed by dqlite.
	GlobalDatabasePath() string

	// VarDir represents the Data directory (e.g. /var/lib/therm/).
	VarDir() string

	// Hostname returns the host name reported by the kernel.
	Hostname() (string, error)

	// HostNames will generate a list of names for which the certificate will be
	// valid.
	// This will include the hostname and ip address
	HostNames() ([]string, error)

	// User returns the current user.
	User() (*user.User, error)
}

OS is a high-level facade for accessing all operating-system level functionality that therm uses.

type ServiceMember

type ServiceMember struct {
	ServerName    string
	ServerAddress string
	DaemonAddress string
	DaemonNonce   string
	Status        string
	Message       string
}

ServiceMember represents a service node in the cluster.

type State

type State interface {
	// Node returns the underlying Node
	Node() Node

	// Cluster returns the underlying Cluster
	Cluster() Cluster

	// OS returns the underlying OS values
	OS() OS
}

State is a gateway to the two main stateful components, the database and the operating system. It's typically used by model entities in order to perform changes.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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