heartbeat

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DatabaseEndpoint = "/internal/database"

DatabaseEndpoint specifies the API endpoint path that gets routed to a dqlite server handler for performing SQL queries against the dqlite server running on this node.

View Source
const Interval = 4

Interval represents the number of seconds to wait between to heartbeat rounds.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertConfig

type CertConfig interface {

	// Read returns a TLS configuration suitable for establishing inter-node
	// network connections using the cluster certificate.
	Read(*cert.Info) (*tls.Config, error)
}

CertConfig manages reading a certificate information and convert it into a tls.Config.

type Cluster

type Cluster interface {
	db.ClusterTransactioner
}

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

type Gateway

type Gateway interface {

	// RaftNodes returns information about the nodes that a currently part of
	// the raft cluster, as configured in the raft log. It returns an error if this
	// node is not the leader.
	RaftNodes() ([]db.RaftNode, error)

	// DB returns the database node of the cluster
	DB() Node

	// Cert returns the gateway certificate information
	Cert() *cert.Info

	// Clustered returns if the Gateway is a raft node or is not clustered
	Clustered() bool
}

Gateway mediates access to the dqlite cluster using a gRPC SQL client, and possibly runs a dqlite replica on this node (if we're configured to do so).

type Heartbeat

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

Heartbeat performs leader-initiated heartbeat checks against all nodes in the cluster.

func New

func New(gateway Gateway, cluster Cluster, databaseEndpoint string, options ...Option) *Heartbeat

New creates a new heartbeat with sane defaults

func (*Heartbeat) Run

func (h *Heartbeat) Run() (task.Func, task.Schedule)

Run returns a task function that performs leader-initiated heartbeat checks against all nodes in the cluster.

It will update the heartbeat timestamp column of the nodes table accordingly, and also notify them of the current list of database nodes.

type Node

type Node interface {
	db.NodeTransactioner
}

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

type Option

type Option func(*options)

Option to be passed to Connect to customize the resulting instance.

func WithLogger

func WithLogger(logger log.Logger) Option

WithLogger sets the logger on the option

type Task

type Task interface {

	// Every returns a Schedule that always returns the given time interval.
	Every(interval time.Duration, options ...task.EveryOption) task.Schedule
}

Task executes a certain function periodically, according to a certain schedule.

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