Documentation ¶
Overview ¶
Package regioninfo contains data structures to represent HBase regions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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{}.
Types ¶
type Info ¶
type Info struct { // Table name. Table []byte // RegionName. RegionName []byte // StartKey StartKey []byte // StopKey. StopKey []byte // contains filtered or unexported fields }
Info describes a region.
func InfoFromCell ¶
InfoFromCell parses a KeyValue from the meta table and creates the corresponding Info object.
func (*Info) GetAvailabilityChan ¶
func (i *Info) GetAvailabilityChan() <-chan struct{}
GetAvailabilityChan returns a channel that can be used to wait on for notification that a connection to this region has been reestablished. If this region is not marked as unavailable, nil will be returned.
func (*Info) IsUnavailable ¶
IsUnavailable returns true if this region has been marked as unavailable.
func (*Info) MarkAvailable ¶
func (i *Info) MarkAvailable()
MarkAvailable will mark this region as available again, by closing the struct returned by GetAvailabilityChan
func (*Info) MarkUnavailable ¶
MarkUnavailable will mark this region as unavailable, by creating the struct returned by GetAvailabilityChan. If this region was marked as available before this, true will be returned.