region

package
v0.0.0-...-765c624 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrShortWrite is used when the writer thread only succeeds in writing
	// part of its buffer to the socket, and not all of the buffer was sent
	ErrShortWrite = fmt.Errorf("short write occurred while writing to socket")
)

Functions

func Compare

func Compare(a, b []byte) int

Compare compares two region names. We can't just use bytes.Compare() because it doesn't play nicely with the way META keys are built as the first region has an empty start key. Let's assume we know about those 2 regions in our cache:

.META.,,1
tableA,,1273018455182

We're given an RPC to execute on "tableA", row "\x00" (1 byte row key containing a 0). If we use Compare() to sort the entries in the cache, when we search for the entry right before "tableA,\000,:" we'll erroneously find ".META.,,1" instead of the entry for first region of "tableA".

Since this scheme breaks natural ordering, we need this comparator to implement a special version of comparison to handle this scenario.

func CompareGeneric

func CompareGeneric(a, b interface{}) int

CompareGeneric is the same thing as Compare but for interface{}.

Types

type Client

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

Client manages a connection to a RegionServer.

func NewClient

func NewClient(host string, port uint16) (*Client, error)

NewClient creates a new RegionClient.

func (*Client) QueueRPC

func (c *Client) QueueRPC(rpc hrpc.Call)

func (*Client) SendRPC

func (c *Client) SendRPC(rpc hrpc.Call) (proto.Message, error)

SendRPC sends an RPC out to the wire. Returns the response (for now, as the call is synchronous).

type Info

type Info struct {
	// Table name.
	Table []byte

	// RegionName.
	RegionName []byte

	// StopKey.
	StopKey []byte
}

Info describes a region.

func InfoFromCell

func InfoFromCell(cell *pb.Cell) (*Info, error)

InfoFromCell parses a KeyValue from the meta table and creates the corresponding Info object.

func (*Info) String

func (i *Info) String() string

Jump to

Keyboard shortcuts

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