Documentation
¶
Overview ¶
Package cluster handles creating a cluster of local rqlite nodes and injecting faults into the cluster.
This is used for running system tests.
Index ¶
- type Cluster
- func (c *Cluster) AddNode(node *Node)
- func (c *Cluster) Addrs() []string
- func (c *Cluster) Close() error
- func (c *Cluster) NodeAddrs() map[uint32]string
- func (c *Cluster) NodeRaftAddrs() map[uint32]string
- func (c *Cluster) RemoveNode(id uint32)
- func (c *Cluster) WaitForHealthy(ctx context.Context) bool
- type Node
- func (n *Node) APIAdvAddr() string
- func (n *Node) Close() error
- func (n *Node) ID() uint32
- func (n *Node) RaftAdvAddr() string
- func (n *Node) Reboot(duration int64, timeout bool) error
- func (n *Node) Status(ctx context.Context) (gorqlite.Status, error)
- func (n *Node) WaitForAllFSM(ctx context.Context) (int, error)
- func (n *Node) WaitForLeader(ctx context.Context) (string, error)
- type NodeOption
- func WithAPIAddr(addr string) NodeOption
- func WithAPIAdvAddr(addr string) NodeOption
- func WithDir(dir string) NodeOption
- func WithJoin(addr string) NodeOption
- func WithRaftAddr(addr string) NodeOption
- func WithRaftAdvAddr(addr string) NodeOption
- func WithRaftSnapInterval(interval string) NodeOption
- func WithRaftSnapThreshold(threshold int) NodeOption
- func WithRaftVoter(voter bool) NodeOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewCluster ¶
func NewCluster() *Cluster
func OpenCluster ¶
ConnectCluster creates a new cluster with `numNodes` nodes where the first node is the leader that the other nodes join.
func RunDefaultCluster ¶
RunDefaultCluster runs a cluster with 3 nodes and waits for it to be healthy.
func (*Cluster) NodeRaftAddrs ¶
func (*Cluster) RemoveNode ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) APIAdvAddr ¶
func (*Node) RaftAdvAddr ¶
func (*Node) WaitForAllFSM ¶
WaitForAllFSM waits until all outstanding database commands have actually been applied to the database i.e. state machine.
type NodeOption ¶
type NodeOption func(conf *nodeConfig)
NodeOption overrides the default node configuration.
func WithAPIAddr ¶
func WithAPIAddr(addr string) NodeOption
func WithAPIAdvAddr ¶
func WithAPIAdvAddr(addr string) NodeOption
func WithDir ¶
func WithDir(dir string) NodeOption
func WithJoin ¶
func WithJoin(addr string) NodeOption
WithJoin requests the node joins an existing cluster at addr.
func WithRaftAddr ¶
func WithRaftAddr(addr string) NodeOption
func WithRaftAdvAddr ¶
func WithRaftAdvAddr(addr string) NodeOption
func WithRaftSnapInterval ¶
func WithRaftSnapInterval(interval string) NodeOption
func WithRaftSnapThreshold ¶
func WithRaftSnapThreshold(threshold int) NodeOption
func WithRaftVoter ¶
func WithRaftVoter(voter bool) NodeOption
Click to show internal directories.
Click to hide internal directories.