regioninfo

package
v0.0.0-...-51c9c64 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

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

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 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

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

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

func (i *Info) IsUnavailable() bool

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

func (i *Info) MarkUnavailable() bool

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.

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