region

package
v0.0.0-...-636e2cf Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RegionClient is a ClientType that means this will be a normal client
	RegionClient = ClientType("ClientService")

	// MasterClient is a ClientType that means this client will talk to the
	// master server
	MasterClient = ClientType("MasterService")
)

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 = errors.New("Short write occurred while writing to socket")

	// ErrMissingCallID is used when HBase sends us a response message for a
	// request that we didn't send
	ErrMissingCallID = errors.New("Got a response with a nonsensical call ID")

	// ErrClientClosed is returned to rpcs when Close() is called
	ErrClientClosed = errors.New("Client closed")

	ErrRegionUnavailable = errors.New("Region is unavailable")

	// queue size of region client
	QUEUE_SIZE = 100
	// timeout before flushing the queue in region client
	FLUSH_INTERVAL = 20 * time.Millisecond
)

Functions

This section is empty.

Types

type Client

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

client manages a connection to a RegionServer.

func NewClient

func NewClient(ctx context.Context, host string, port uint16, ctype ClientType,
	queueSize int, flushInterval time.Duration) (*Client, error)

NewClient creates a new RegionClient.

func (*Client) AddRegion

func (c *Client) AddRegion(r *Region)

func (*Client) ClientDown

func (c *Client) ClientDown()

func (*Client) Close

func (c *Client) Close()

Close asks this region.Client to close its connection to the RegionServer. All queued and outstanding RPCs, if any, will be failed as if a connection error had happened.

func (*Client) Host

func (c *Client) Host() string

Host returns the host that this client talks to

func (*Client) Port

func (c *Client) Port() uint16

Port returns the port that this client talks over

func (*Client) QueueRPC

func (c *Client) QueueRPC(rpc hrpc.RpcCall) error

QueueRPC will add an rpc call to the queue for processing by the writer goroutine

func (*Client) RemoveRegion

func (c *Client) RemoveRegion(r *Region)

type ClientType

type ClientType string

ClientType is a type alias to represent the type of this region client

type Region

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

func NewRegion

func NewRegion(table, name, startKey, stopKey []byte) *Region

NewInfo creates a new region info

func ParseRegionInfo

func ParseRegionInfo(metaRow *hrpc.Result) (*Region, string, uint16, error)

ParseRegionInfo parses the contents of a row from the meta table. It's guaranteed to return a region info and a host/port OR return an error.

func (*Region) Available

func (r *Region) Available() bool

Available returns true if this region is available

func (*Region) Client

func (r *Region) Client() *Client

func (*Region) Connect

func (r *Region) Connect(ctx context.Context, host string, port uint16) *Client

func (*Region) Find

func (r *Region) Find(key []byte) *Region

func (*Region) Lock

func (r *Region) Lock()

func (*Region) MarkUnavailable

func (r *Region) MarkUnavailable() *Client

func (*Region) Name

func (r *Region) Name() []byte

Name returns region name

func (*Region) SetClient

func (r *Region) SetClient(client *Client)

func (*Region) SetName

func (r *Region) SetName(name []byte)

func (*Region) Split

func (r *Region) Split(fetched *Region)

Split current region node with fetched region info from HBase

func (*Region) StartKey

func (r *Region) StartKey() []byte

StartKey return region start key

func (*Region) StopKey

func (r *Region) StopKey() []byte

StopKey return region stop key

func (*Region) String

func (r *Region) String() string

func (*Region) Table

func (r *Region) Table() []byte

Table returns region table

func (*Region) Unlock

func (r *Region) Unlock()

type RetryableError

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

RetryableError is an error that indicates the RPC should be retried because the error is transient (e.g. a region being momentarily unavailable).

func (RetryableError) Error

func (e RetryableError) Error() string

type UnrecoverableError

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

UnrecoverableError is an error that this region.Client can't recover from. The connection to the RegionServer has to be closed and all queued and outstanding RPCs will be failed / retried.

func (UnrecoverableError) Error

func (e UnrecoverableError) Error() string

Jump to

Keyboard shortcuts

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