Documentation ¶
Overview ¶
Package server implements a basic HTTP server for interacting with a node.
Index ¶
- Variables
- func BootstrapCluster(clusterID string, engine storage.Engine) (*kv.LocalDB, error)
- type Node
- func (n *Node) AccumulateTS(args *storage.AccumulateTSRequest, reply *storage.AccumulateTSResponse) error
- func (n *Node) Contains(args *storage.ContainsRequest, reply *storage.ContainsResponse) error
- func (n *Node) Delete(args *storage.DeleteRequest, reply *storage.DeleteResponse) error
- func (n *Node) DeleteRange(args *storage.DeleteRangeRequest, reply *storage.DeleteRangeResponse) error
- func (n *Node) EndTransaction(args *storage.EndTransactionRequest, reply *storage.EndTransactionResponse) error
- func (n *Node) EnqueueMessage(args *storage.EnqueueMessageRequest, reply *storage.EnqueueMessageResponse) error
- func (n *Node) EnqueueUpdate(args *storage.EnqueueUpdateRequest, reply *storage.EnqueueUpdateResponse) error
- func (n *Node) Get(args *storage.GetRequest, reply *storage.GetResponse) error
- func (n *Node) Increment(args *storage.IncrementRequest, reply *storage.IncrementResponse) error
- func (n *Node) InternalRangeLookup(args *storage.InternalRangeLookupRequest, ...) error
- func (n *Node) Put(args *storage.PutRequest, reply *storage.PutResponse) error
- func (n *Node) ReapQueue(args *storage.ReapQueueRequest, reply *storage.ReapQueueResponse) error
- func (n *Node) Scan(args *storage.ScanRequest, reply *storage.ScanResponse) error
Constants ¶
This section is empty.
Variables ¶
var CmdGetZone = &commander.Command{ UsageLine: "get-zone [options] <key-prefix>", Short: "fetches and displays the zone config", Long: ` Fetches and displays the zone configuration for <key-prefix>. The key prefix should be escaped via URL query escaping if it contains non-ascii bytes or spaces. `, Run: runGetZones, Flag: *flag.CommandLine, }
A CmdGetZone command displays the zone config for the specified prefix.
var CmdInit = &commander.Command{ UsageLine: "init <bootstrap store>", Short: "init new Cockroach cluster", Long: ` Initialize a new Cockroach cluster on this node. The cluster is started with only a single replica, whose data is stored in the directory specified by the first argument <bootstrap store>. The format of the bootstrap store is given by the specification below. Note that attributes should not specify in-memory ("mem"). <comma-separated store attributes>=<data dir path> For example: cockroach init hdd,7200rpm=/mnt/hda1 To start the cluster after initialization, run "cockroach start". `, Run: runInit, Flag: *flag.CommandLine, }
A CmdInit command initializes a new Cockroach cluster.
var CmdLsZones = &commander.Command{ UsageLine: "ls-zones [options] [key-regexp]", Short: "list all zone configs by key prefix", Long: ` List zone configs. If a regular expression is given, the results of the listing are filtered by key prefixes matching the regexp. The key prefix should be escaped via URL query escaping if it contains non-ascii bytes or spaces. `, Run: runLsZones, Flag: *flag.CommandLine, }
A CmdLsZones command displays a list of zone configs by prefix.
var CmdRmZone = &commander.Command{ UsageLine: "rm-zone [options] <key-prefix>", Short: "remove a zone config by key prefix", Long: ` Remove an existing zone config by key prefix. No action is taken if no zone configuration exists for the specified key prefix. Note that this command can affect only a single zone config with an exactly matching prefix. The key prefix should be escaped via URL query escaping if it contains non-ascii bytes or spaces. `, Run: runRmZone, Flag: *flag.CommandLine, }
A CmdRmZone command removes a zone config by prefix.
var CmdSetZone = &commander.Command{ UsageLine: "set-zone [options] <key-prefix> <zone-config-file>", Short: "create or update zone config for key prefix", Long: ` Create or update a zone config for the specified key prefix (first argument: <key-prefix>) to the contents of the specified file (second argument: <zone-config-file>). The key prefix should be escaped via URL query escaping if it contains non-ascii bytes or spaces. The zone config format has the following YAML schema: replicas: - [comma-separated attribute list] - ... range_min_bytes: <size-in-bytes> range_max_bytes: <size-in-bytes> For example: replicas: - [us-east-1a, ssd] - [us-east-1b, ssd] - [us-west-1b, ssd] range_min_bytes: 8388608 range_min_bytes: 67108864 Setting zone configs will guarantee that key ranges will be split such that no key range straddles two zone config specifications. This feature can be taken advantage of to pre-split ranges. `, Run: runSetZone, Flag: *flag.CommandLine, }
A CmdSetZone command creates a new or updates an existing zone config.
var CmdStart = &commander.Command{ UsageLine: "start -gossip=host1:port1[,host2:port2...] " + "-stores=(ssd=<data-dir>|hdd=<data-dir>|mem=<capacity-in-bytes>)[,...]", Short: "start node by joining the gossip network", Long: fmt.Sprintf(` Start Cockroach node by joining the gossip network and exporting key ranges stored on physical device(s). The gossip network is joined by contacting one or more well-known hosts specified by the -gossip command line flag. Every node should be run with the same list of bootstrap hosts to guarantee a connected network. An alternate approach is to use a single host for -gossip and round-robin DNS. Each node exports data from one or more physical devices. These devices are specified via the -stores command line flag. This is a comma-separated list of paths to storage directories or for in-memory stores, the number of bytes. Although the paths should be specified to correspond uniquely to physical devices, this requirement isn't strictly enforced. A node exports an HTTP API with the following endpoints: Health check: /healthz Key-value REST: %s Structured Schema REST: %s `, kv.KVKeyPrefix, structured.StructuredKeyPrefix), Run: runStart, Flag: *flag.CommandLine, }
A CmdStart command starts nodes by joining the gossip network.
Functions ¶
func BootstrapCluster ¶
BootstrapCluster bootstraps a store using the provided engine and cluster ID. The bootstrapped store contains a single range spanning all keys. Initial range lookup metadata is populated for the range.
Returns a direct-access kv.LocalDB for unittest purposes only.
Types ¶
type Node ¶
type Node struct { ClusterID string // UUID for Cockroach cluster Descriptor storage.NodeDescriptor // Node ID, network/physical topology // contains filtered or unexported fields }
Node manages a map of stores (by store ID) for which it serves traffic.
func NewNode ¶
NewNode returns a new instance of Node, interpreting command line flags to initialize the appropriate Store or set of Stores. Registers the storage instance for the RPC service "Node".
func (*Node) AccumulateTS ¶
func (n *Node) AccumulateTS(args *storage.AccumulateTSRequest, reply *storage.AccumulateTSResponse) error
AccumulateTS .
func (*Node) Contains ¶
func (n *Node) Contains(args *storage.ContainsRequest, reply *storage.ContainsResponse) error
Contains .
func (*Node) Delete ¶
func (n *Node) Delete(args *storage.DeleteRequest, reply *storage.DeleteResponse) error
Delete .
func (*Node) DeleteRange ¶
func (n *Node) DeleteRange(args *storage.DeleteRangeRequest, reply *storage.DeleteRangeResponse) error
DeleteRange .
func (*Node) EndTransaction ¶
func (n *Node) EndTransaction(args *storage.EndTransactionRequest, reply *storage.EndTransactionResponse) error
EndTransaction .
func (*Node) EnqueueMessage ¶
func (n *Node) EnqueueMessage(args *storage.EnqueueMessageRequest, reply *storage.EnqueueMessageResponse) error
EnqueueMessage .
func (*Node) EnqueueUpdate ¶
func (n *Node) EnqueueUpdate(args *storage.EnqueueUpdateRequest, reply *storage.EnqueueUpdateResponse) error
EnqueueUpdate .
func (*Node) Get ¶
func (n *Node) Get(args *storage.GetRequest, reply *storage.GetResponse) error
Get .
func (*Node) Increment ¶
func (n *Node) Increment(args *storage.IncrementRequest, reply *storage.IncrementResponse) error
Increment .
func (*Node) InternalRangeLookup ¶
func (n *Node) InternalRangeLookup(args *storage.InternalRangeLookupRequest, reply *storage.InternalRangeLookupResponse) error
InternalRangeLookup .
func (*Node) Put ¶
func (n *Node) Put(args *storage.PutRequest, reply *storage.PutResponse) error
Put .
func (*Node) ReapQueue ¶
func (n *Node) ReapQueue(args *storage.ReapQueueRequest, reply *storage.ReapQueueResponse) error
ReapQueue .
func (*Node) Scan ¶
func (n *Node) Scan(args *storage.ScanRequest, reply *storage.ScanResponse) error
Scan .