system

package
v8.23.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package system supports running end-to-end type testing of rqlite

Index

Constants

View Source
const (
	// SnapshotInterval is the period between snapshot checks
	SnapshotInterval = time.Second

	// SnapshotThreshold is the number of outstanding log entries before a snapshot is triggered
	SnapshotThreshold = 100

	// ElectionTimeout is the period between elections. It's longer than
	// the default to allow for slow CI systems.
	ElectionTimeout = 2 * time.Second

	NoQueryTimeout = 0
)

Variables

View Source
var (
	// QueuedResponseRegex is the regex for matching Queued Write responses
	QueuedResponseRegex = regexp.MustCompile(`^{"results":\[\],"sequence_number":\d+}$`)
)

Functions

func PostExecuteStmt

func PostExecuteStmt(apiAddr string, stmt string) (string, error)

PostExecuteStmt performs a HTTP execute request

func PostExecuteStmtMulti

func PostExecuteStmtMulti(apiAddr string, stmts []string) (string, error)

PostExecuteStmtMulti performs a HTTP batch execute request

func Remove

func Remove(n *Node, addr string) error

Remove tells the cluster at n to remove the node at addr. Assumes n is the leader.

Types

type Cluster

type Cluster []*Node

Cluster represents a cluster of nodes.

func (Cluster) Deprovision

func (c Cluster) Deprovision()

Deprovision deprovisions every node in the cluster.

func (Cluster) FindNodeByRaftAddr

func (c Cluster) FindNodeByRaftAddr(addr string) (*Node, error)

FindNodeByRaftAddr returns the node with the given Raft address.

func (Cluster) Followers

func (c Cluster) Followers() ([]*Node, error)

Followers returns the slice of nodes in the cluster that are followers.

func (Cluster) Leader

func (c Cluster) Leader() (*Node, error)

Leader returns the leader node of a cluster.

func (Cluster) RemoveNode

func (c Cluster) RemoveNode(node *Node) Cluster

RemoveNode removes the given node from the list of nodes representing a cluster.

func (Cluster) WaitForNewLeader

func (c Cluster) WaitForNewLeader(old *Node) (*Node, error)

WaitForNewLeader waits for the leader to change from the node passed in.

type Node

type Node struct {
	APIAddr      string
	RaftAddr     string
	ID           string
	Dir          string
	NodeCertPath string
	NodeKeyPath  string
	HTTPCertPath string
	HTTPKeyPath  string
	TLSConfig    *tls.Config
	PeersPath    string
	Store        *store.Store
	Service      *httpd.Service
	Cluster      *cluster.Service
	Client       *cluster.Client
}

Node represents a node under test.

func (*Node) Backup added in v8.16.0

func (n *Node) Backup(filename string, compress bool) error

Backup backs up the node's database to the given file.

func (*Node) Boot

func (n *Node) Boot(filename string) (string, error)

Load loads a SQLite database file into the node.

func (*Node) Close

func (n *Node) Close(graceful bool) error

Close closes the node.

func (*Node) ConfirmRedirect

func (n *Node) ConfirmRedirect(host string) bool

ConfirmRedirect confirms that the node responds with a redirect to the given host.

func (*Node) Deprovision

func (n *Node) Deprovision()

Deprovision shuts down and removes all resources associated with the node.

func (*Node) EnableTLSClient

func (n *Node) EnableTLSClient()

EnableTLSClient enables TLS support for the node's cluster client.

func (*Node) Execute

func (n *Node) Execute(stmt string) (string, error)

Execute executes a single statement against the node.

func (*Node) ExecuteMulti

func (n *Node) ExecuteMulti(stmts []string) (string, error)

ExecuteMulti executes multiple statements against the node.

func (*Node) ExecuteParameterized

func (n *Node) ExecuteParameterized(stmt []interface{}) (string, error)

ExecuteParameterized executes a single parameterized query against the node

func (*Node) ExecuteQueued

func (n *Node) ExecuteQueued(stmt string, wait bool) (string, error)

ExecuteQueued sends a single statement to the node's Execute queue

func (*Node) ExecuteQueuedMulti

func (n *Node) ExecuteQueuedMulti(stmts []string, wait bool) (string, error)

ExecuteQueuedMulti sends multiple statements to the node's Execute queue

func (*Node) Expvar

func (n *Node) Expvar() (string, error)

Expvar returns the expvar output for node.

func (*Node) ExpvarKey

func (n *Node) ExpvarKey(k string) (string, error)

ExpvarKey returns the expvar output, for a given key, for a node.

func (*Node) IsVoter

func (n *Node) IsVoter() (bool, error)

IsVoter returns whether the node is a voter or not.

func (*Node) Join

func (n *Node) Join(leader *Node) error

Join instructs this node to join the leader.

func (*Node) JoinAsNonVoter

func (n *Node) JoinAsNonVoter(leader *Node) error

JoinAsNonVoter instructs this node to join the leader, but as a non-voting node.

func (*Node) Liveness

func (n *Node) Liveness() (bool, error)

Liveness returns the liveness status for the node, primarily for use by Kubernetes.

func (*Node) Load

func (n *Node) Load(filename string) (string, error)

Load loads a SQLite database file into the node.

func (*Node) Nodes

func (n *Node) Nodes(includeNonVoters bool) (httpd.Nodes, error)

Nodes returns the Nodes endpoint output for node.

func (*Node) Noop

func (n *Node) Noop(id string) error

Noop inserts a noop command into the Store's Raft log.

func (*Node) Notify

func (n *Node) Notify(id, raftAddr string) error

Notify notifies this node of the existence of another node

func (*Node) Query

func (n *Node) Query(stmt string) (string, error)

Query runs a single query against the node.

func (*Node) QueryMulti

func (n *Node) QueryMulti(stmts []string) (string, error)

QueryMulti runs multiple queries against the node.

func (*Node) QueryNoneConsistency

func (n *Node) QueryNoneConsistency(stmt string) (string, error)

QueryNoneConsistency runs a single query against the node, with no read consistency.

func (*Node) QueryParameterized

func (n *Node) QueryParameterized(stmt []interface{}) (string, error)

QueryParameterized run a single parameterized query against the node

func (*Node) QueryStrongConsistency

func (n *Node) QueryStrongConsistency(stmt string) (string, error)

QueryStrongConsistency runs a single query against the node, with Strong read consistency.

func (*Node) QueryWithBlobArray added in v8.22.0

func (n *Node) QueryWithBlobArray(stmt string) (string, error)

QueryWithBlobArray runs a single query against the node, with BLOB byte array support.

func (*Node) QueryWithTimeout added in v8.19.0

func (n *Node) QueryWithTimeout(stmt string, timeout time.Duration) (string, error)

QueryWithTimeout runs a single query against the node, with a timeout.

func (*Node) Ready

func (n *Node) Ready() (bool, error)

Ready returns the ready status for the node

func (*Node) Request

func (n *Node) Request(stmt string) (string, error)

Request runs a single request against the node.

func (*Node) RequestMulti

func (n *Node) RequestMulti(stmts []string) (string, error)

RequestMulti runs multiple statements in a single request against the node.

func (*Node) RequestMultiParameterized

func (n *Node) RequestMultiParameterized(stmt []interface{}) (string, error)

RequestMultiParameterized runs a single parameterized request against the node

func (*Node) SameAs

func (n *Node) SameAs(o *Node) bool

SameAs returns true if this node is the same as node o.

func (*Node) Status

func (n *Node) Status() (string, error)

Status returns the status and diagnostic output for node.

func (*Node) WaitForLeader

func (n *Node) WaitForLeader() (string, error)

WaitForLeader blocks for up to 10 seconds until the node detects a leader.

Jump to

Keyboard shortcuts

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