Documentation ¶
Overview ¶
Package region contains data structures to represent HBase regions.
Index ¶
- Constants
- Variables
- func Compare(a, b []byte) int
- func CompareGeneric(a, b interface{}) int
- func NewClient(addr string, ctype ClientType, queueSize int, flushInterval time.Duration, ...) hrpc.RegionClient
- func NewInfo(id uint64, namespace, table, name, startKey, stopKey []byte) hrpc.RegionInfo
- func ParseRegionInfo(metaRow *hrpc.Result) (hrpc.RegionInfo, string, error)
- type ClientType
- type NotServingRegionError
- type OfflineRegionError
- type RetryableError
- type ServerError
Constants ¶
const ( //DefaultLookupTimeout is the default region lookup timeout DefaultLookupTimeout = 30 * time.Second //DefaultReadTimeout is the default region read timeout DefaultReadTimeout = 30 * time.Second // 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 ¶
var ( // ErrMissingCallID is used when HBase sends us a response message for a // request that we didn't send ErrMissingCallID = ServerError{errors.New("got a response with a nonsensical call ID")} // ErrClientClosed is returned to rpcs when Close() is called or when client // died because of failed send or receive ErrClientClosed = ServerError{errors.New("client is closed")} )
Functions ¶
func Compare ¶
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{}.
func NewClient ¶
func NewClient(addr string, ctype ClientType, queueSize int, flushInterval time.Duration, effectiveUser string, readTimeout time.Duration, codec compression.Codec) hrpc.RegionClient
NewClient creates a new RegionClient.
func NewInfo ¶
func NewInfo(id uint64, namespace, table, name, startKey, stopKey []byte) hrpc.RegionInfo
NewInfo creates a new region info
func ParseRegionInfo ¶
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.
Types ¶
type ClientType ¶
type ClientType string
ClientType is a type alias to represent the type of this region client
type NotServingRegionError ¶
type NotServingRegionError struct {
// contains filtered or unexported fields
}
NotServingRegionError is an error that indicates the client should reestablish the region and retry the RPC potentially via a different client
func (NotServingRegionError) Error ¶
func (e NotServingRegionError) Error() string
type OfflineRegionError ¶
type OfflineRegionError struct {
// contains filtered or unexported fields
}
OfflineRegionError is returned if region is offline
func (OfflineRegionError) Error ¶
func (e OfflineRegionError) Error() string
type RetryableError ¶
type RetryableError struct {
// contains filtered or unexported fields
}
RetryableError is an error that indicates the RPC should be retried after backoff because the error is transient (e.g. a region being momentarily unavailable).
func (RetryableError) Error ¶
func (e RetryableError) Error() string
type ServerError ¶
type ServerError struct {
// contains filtered or unexported fields
}
ServerError 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 (ServerError) Error ¶
func (e ServerError) Error() string