Documentation ¶
Index ¶
- Variables
- func HTTPPort(nodeIdx int) int
- func IsUnavailableError(err error) bool
- func RPCPort(nodeIdx int) int
- type Cluster
- func (c *Cluster) Close()
- func (c *Cluster) Freeze(nodeIdx int, freeze bool)
- func (c *Cluster) IPAddr(nodeIdx int) string
- func (c *Cluster) RPCAddr(nodeIdx int) string
- func (c *Cluster) RandNode(f func(int) int) int
- func (c *Cluster) Split(nodeIdx int, splitKey roachpb.Key) error
- func (c *Cluster) Start(db string, numWorkers int, binary string, allNodeArgs []string, ...)
- func (c *Cluster) TransferLease(nodeIdx int, r *rand.Rand, key roachpb.Key) (bool, error)
- func (c *Cluster) UpdateZoneConfig(rangeMinBytes, rangeMaxBytes int64)
- type Node
Constants ¶
This section is empty.
Variables ¶
var CockroachBin = func() string { bin := "./cockroach" if _, err := os.Stat(bin); os.IsNotExist(err) { bin = "cockroach" } else if err != nil { panic(err) } return bin }()
CockroachBin is the path to the cockroach binary.
Functions ¶
func IsUnavailableError ¶
IsUnavailableError returns true iff the error corresponds to a GRPC connection unavailable error.
Types ¶
type Cluster ¶
type Cluster struct { Nodes []*Node Clients []*client.DB Status []serverpb.StatusClient DB []*gosql.DB // contains filtered or unexported fields }
Cluster holds the state for a local cluster, providing methods for common operations, access to the underlying nodes and per-node KV and SQL clients.
func New ¶
New creates a cluster of size nodes. separateAddrs controls whether all the nodes use the same localhost IP address (127.0.0.1) or separate addresses (e.g. 127.1.1.1, 127.1.1.2, etc).
func (*Cluster) Close ¶
func (c *Cluster) Close()
Close stops the cluster, killing all of the nodes.
func (*Cluster) Freeze ¶
Freeze freezes (or thaws) the cluster. The freeze request is sent to the specified node.
func (*Cluster) Start ¶
func (c *Cluster) Start( db string, numWorkers int, binary string, allNodeArgs []string, perNodeArgs, perNodeEnv map[int][]string, )
Start starts a cluster. The numWorkers parameter controls the SQL connection settings to avoid unnecessary connection creation. The allNodeArgs parameter can be used to pass extra arguments to every node. The perNodeArgs parameter can be used to pass extra arguments to an individual node. If not nil, its size must equal the number of nodes.
func (*Cluster) TransferLease ¶
TransferLease transfers the lease for the range containing key to a random alive node in the range.
func (*Cluster) UpdateZoneConfig ¶
UpdateZoneConfig updates the default zone config for the cluster.