hbase

package module
v0.0.0-...-7719ebb Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2017 License: BSD-3-Clause, MIT Imports: 20 Imported by: 4

README

[UNMAINTAINED]

Build Status

Derived from Lazyshot/go-hbase. Add some new features and fix some bugs.

New Features

  1. Coprocessor EndPoint call.
  2. Goroutine-safe.
  3. Admin commands: Create/Disable/Drop table.
  4. Pipelined RPC.

Support HBase >= 0.98.5

Documentation

Index

Constants

View Source
const (
	MasterMonitorService = iota + 1
	MasterService
	MasterAdminService
	AdminService
	ClientService
	RegionServerStatusService
)
View Source
const (
	TypeMinimum             = Type(0)
	TypePut                 = Type(4)
	TypeDelete              = Type(8)
	TypeDeleteFamilyVersion = Type(10)
	TypeDeleteColumn        = Type(12)
	TypeDeleteFamily        = Type(14)
	TypeMaximum             = Type(0xff)
)

Variables

View Source
var ServiceString = map[ServiceType]string{
	MasterMonitorService:      "MasterMonitorService",
	MasterService:             "MasterService",
	MasterAdminService:        "MasterAdminService",
	AdminService:              "AdminService",
	ClientService:             "ClientService",
	RegionServerStatusService: "RegionServerStatusService",
}

convert above const to protobuf string

Functions

func ErrorEqual

func ErrorEqual(err1, err2 error) bool

TODO: The following functions can be moved later. ErrorEqual returns a boolean indicating whether err1 is equal to err2.

func ErrorNotEqual

func ErrorNotEqual(err1, err2 error) bool

ErrorNotEqual returns a boolean indicating whether err1 isn't equal to err2.

func NewRegionSpecifier

func NewRegionSpecifier(regionName string) *proto.RegionSpecifier

Types

type BytesSlice

type BytesSlice [][]byte

func (BytesSlice) Len

func (s BytesSlice) Len() int

func (BytesSlice) Less

func (s BytesSlice) Less(i, j int) bool

func (BytesSlice) Swap

func (s BytesSlice) Swap(i, j int)

type Column

type Column struct {
	Family []byte
	Qual   []byte
}

func NewColumn

func NewColumn(family, qual []byte) *Column

func (*Column) ParseFromString

func (c *Column) ParseFromString(s string) error

func (*Column) String

func (c *Column) String() string

func (*Column) Write

func (c *Column) Write(w io.Writer) error

type ColumnCoordinate

type ColumnCoordinate struct {
	Table []byte
	Row   []byte
	Column
}

func NewColumnCoordinate

func NewColumnCoordinate(table, row, family, qual []byte) *ColumnCoordinate

func (*ColumnCoordinate) Equal

func (c *ColumnCoordinate) Equal(a *ColumnCoordinate) bool

func (*ColumnCoordinate) GetColumn

func (c *ColumnCoordinate) GetColumn() *Column

func (*ColumnCoordinate) ParseField

func (*ColumnCoordinate) ParseFromString

func (c *ColumnCoordinate) ParseFromString(s string) error

func (*ColumnCoordinate) String

func (c *ColumnCoordinate) String() string

func (*ColumnCoordinate) Write

func (c *ColumnCoordinate) Write(w io.Writer) error

type ColumnFamilyDescriptor

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

func NewColumnFamilyDescriptor

func NewColumnFamilyDescriptor(name string) *ColumnFamilyDescriptor

Themis will use VERSIONS=1 for some hook.

func (*ColumnFamilyDescriptor) AddAttr

func (c *ColumnFamilyDescriptor) AddAttr(attrName string, val string)

type CoprocessorServiceCall

type CoprocessorServiceCall struct {
	Row          []byte
	ServiceName  string
	MethodName   string
	RequestParam []byte
}

func (*CoprocessorServiceCall) ToProto

func (c *CoprocessorServiceCall) ToProto() pb.Message

type Delete

type Delete struct {
	Row         []byte
	Families    set
	FamilyQuals map[string]set
	Ts          map[string]uint64
}

func NewDelete

func NewDelete(row []byte) *Delete

func (*Delete) AddColumn

func (d *Delete) AddColumn(family, qual []byte) *Delete

func (*Delete) AddColumnWithTimestamp

func (d *Delete) AddColumnWithTimestamp(family, qual []byte, ts uint64) *Delete

func (*Delete) AddFamily

func (d *Delete) AddFamily(family []byte) *Delete

func (*Delete) AddString

func (d *Delete) AddString(famqual string) error

func (*Delete) AddStringColumn

func (d *Delete) AddStringColumn(family, qual string) *Delete

func (*Delete) AddStringFamily

func (d *Delete) AddStringFamily(family string) *Delete

func (*Delete) GetRow

func (d *Delete) GetRow() []byte

func (*Delete) ToProto

func (d *Delete) ToProto() pb.Message

type Get

type Get struct {
	Row         []byte
	Families    set
	FamilyQuals map[string]set
	Versions    int32
	TsRangeFrom uint64
	TsRangeTo   uint64
}

func NewGet

func NewGet(row []byte) *Get

func (*Get) AddColumn

func (g *Get) AddColumn(family, qual []byte) *Get

func (*Get) AddFamily

func (g *Get) AddFamily(family []byte) *Get

func (*Get) AddString

func (g *Get) AddString(famqual string) error

func (*Get) AddStringColumn

func (g *Get) AddStringColumn(family, qual string) *Get

func (*Get) AddStringFamily

func (g *Get) AddStringFamily(family string) *Get

func (*Get) AddTimeRange

func (g *Get) AddTimeRange(from uint64, to uint64) *Get

func (*Get) GetRow

func (g *Get) GetRow() []byte

func (*Get) SetMaxVersion

func (g *Get) SetMaxVersion(maxVersion int32) *Get

func (*Get) ToProto

func (g *Get) ToProto() pb.Message

type HBaseClient

type HBaseClient interface {
	Get(tbl string, g *Get) (*ResultRow, error)
	Put(tbl string, p *Put) (bool, error)
	Delete(tbl string, d *Delete) (bool, error)
	TableExists(tbl string) (bool, error)
	DropTable(t string) error
	DisableTable(t string) error
	EnableTable(t string) error
	CreateTable(t *TableDescriptor, splits [][]byte) error
	ServiceCall(table string, call *CoprocessorServiceCall) (*proto.CoprocessorServiceResponse, error)
	LocateRegion(table, row []byte, useCache bool) (*RegionInfo, error)
	GetRegions(table []byte, useCache bool) ([]*RegionInfo, error)
	Split(tblOrRegion, splitPoint string) error
	CleanRegionCache(table []byte)
	CleanAllRegionCache()
	Close() error
}

export client interface

func NewClient

func NewClient(zkHosts []string, zkRoot string) (HBaseClient, error)

type Kv

type Kv struct {
	Row   []byte
	Ts    uint64
	Value []byte
	// history results
	Values map[uint64][]byte
	Column
}

func (*Kv) String

func (kv *Kv) String() string

type Put

type Put struct {
	Row        []byte
	Families   [][]byte
	Qualifiers [][][]byte
	Values     [][][]byte
	Timestamp  uint64
}

func NewPut

func NewPut(row []byte) *Put

func (*Put) AddStringValue

func (p *Put) AddStringValue(family, column, value string) *Put

func (*Put) AddTimestamp

func (p *Put) AddTimestamp(ts uint64) *Put

func (*Put) AddValue

func (p *Put) AddValue(family, qual, value []byte) *Put

func (*Put) GetRow

func (p *Put) GetRow() []byte

func (*Put) ToProto

func (p *Put) ToProto() pb.Message

type RegionInfo

type RegionInfo struct {
	Server         string
	StartKey       []byte
	EndKey         []byte
	Name           string
	Ts             string
	TableNamespace string
	TableName      string
	Offline        bool
	Split          bool
}

type ResultRow

type ResultRow struct {
	Row           []byte
	Columns       map[string]*Kv
	SortedColumns []*Kv
}

func NewResultRow

func NewResultRow(result *proto.Result) *ResultRow

func (*ResultRow) String

func (r *ResultRow) String() string

type Scan

type Scan struct {

	// row key
	StartRow []byte
	StopRow  []byte

	MaxVersions uint32
	TsRangeFrom uint64
	TsRangeTo   uint64
	// contains filtered or unexported fields
}

func NewScan

func NewScan(table []byte, batchSize int, c HBaseClient) *Scan

func (*Scan) AddAttr

func (s *Scan) AddAttr(name string, val []byte)

func (*Scan) AddColumn

func (s *Scan) AddColumn(family, qual []byte)

func (*Scan) AddFamily

func (s *Scan) AddFamily(family []byte)

func (*Scan) AddStringColumn

func (s *Scan) AddStringColumn(family, qual string)

func (*Scan) AddStringFamily

func (s *Scan) AddStringFamily(family string)

func (*Scan) AddTimeRange

func (s *Scan) AddTimeRange(from uint64, to uint64)

func (*Scan) Close

func (s *Scan) Close() error

func (*Scan) Closed

func (s *Scan) Closed() bool

func (*Scan) CreateGetFromScan

func (s *Scan) CreateGetFromScan(row []byte) *Get

func (*Scan) Next

func (s *Scan) Next() *ResultRow

type ServiceType

type ServiceType byte

type TableDescriptor

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

func NewTableDesciptor

func NewTableDesciptor(tblName string) *TableDescriptor

func (*TableDescriptor) AddAddr

func (c *TableDescriptor) AddAddr(attrName string, val string)

func (*TableDescriptor) AddColumnDesc

func (t *TableDescriptor) AddColumnDesc(cf *ColumnFamilyDescriptor)

type TableName

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

type Type

type Type byte

Directories

Path Synopsis
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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