hrpc

package
v0.0.0-...-0bc26d2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2016 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotAStruct is returned by any of the *Ref functions when something
	// other than a struct is passed in to their data argument
	ErrNotAStruct = errors.New("data must be a struct")

	// ErrUnsupportedUints is returned when this message is serialized and uints
	// are unsupported on your platform (this will probably never happen)
	ErrUnsupportedUints = errors.New("uints are unsupported on your platform")

	// ErrUnsupportedInts is returned when this message is serialized and ints
	// are unsupported on your platform (this will probably never happen)
	ErrUnsupportedInts = errors.New("ints are unsupported on your platform")
)

Functions

func Families

func Families(fam map[string][]string) func(Call) error

Families is used as a parameter for request creation. Adds families constraint to a request.

func Filters

func Filters(fl filter.Filter) func(Call) error

Filters is used as a parameter for request creation. Adds filters constraint to a request.

Types

type Call

type Call interface {
	Table() []byte

	Key() []byte

	GetRegion() *regioninfo.Info
	SetRegion(region *regioninfo.Info)
	GetName() string
	Serialize() ([]byte, error)
	// Returns a newly created (default-state) protobuf in which to store the
	// response of this call.
	NewResponse() proto.Message

	GetResultChan() chan RPCResult

	GetContext() context.Context

	SetFamilies(fam map[string][]string) error
	SetFilter(ft filter.Filter) error
}

Call represents an HBase RPC call.

type Cell

type Cell pb.Cell

Cell is the smallest level of granularity in returned results. Represents a single cell in HBase (a row will have one cell for every qualifier).

type CreateTable

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

CreateTable represents a CreateTable HBase call

func NewCreateTable

func NewCreateTable(ctx context.Context, table []byte, columns []string) *CreateTable

NewCreateTable creates a new CreateTable request that will create the given table in HBase. For use by the admin client.

func (*CreateTable) GetName

func (ct *CreateTable) GetName() string

GetName returns the name of this RPC call.

func (*CreateTable) NewResponse

func (ct *CreateTable) NewResponse() proto.Message

NewResponse creates an empty protobuf message to read the response of this RPC.

func (*CreateTable) Serialize

func (ct *CreateTable) Serialize() ([]byte, error)

Serialize will convert this HBase call into a slice of bytes to be written to the network

func (*CreateTable) SetFamilies

func (to *CreateTable) SetFamilies(map[string][]string) error

SetFamilies always returns an error.

func (*CreateTable) SetFilter

func (to *CreateTable) SetFilter(filter.Filter) error

SetFilter always returns an error.

type DeleteTable

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

DeleteTable represents a DeleteTable HBase call

func NewDeleteTable

func NewDeleteTable(ctx context.Context, table []byte) *DeleteTable

NewDeleteTable creates a new DeleteTable request that will delete the given table in HBase. For use by the admin client.

func (*DeleteTable) GetName

func (dt *DeleteTable) GetName() string

GetName returns the name of this RPC call.

func (*DeleteTable) NewResponse

func (dt *DeleteTable) NewResponse() proto.Message

NewResponse creates an empty protobuf message to read the response of this RPC.

func (*DeleteTable) Serialize

func (dt *DeleteTable) Serialize() ([]byte, error)

Serialize will convert this HBase call into a slice of bytes to be written to the network

func (*DeleteTable) SetFamilies

func (to *DeleteTable) SetFamilies(map[string][]string) error

SetFamilies always returns an error.

func (*DeleteTable) SetFilter

func (to *DeleteTable) SetFilter(filter.Filter) error

SetFilter always returns an error.

type DisableTable

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

DisableTable represents a DisableTable HBase call

func NewDisableTable

func NewDisableTable(ctx context.Context, table []byte) *DisableTable

NewDisableTable creates a new DisableTable request that will disable the given table in HBase. For use by the admin client.

func (*DisableTable) GetName

func (dt *DisableTable) GetName() string

GetName returns the name of this RPC call.

func (*DisableTable) NewResponse

func (dt *DisableTable) NewResponse() proto.Message

NewResponse creates an empty protobuf message to read the response of this RPC.

func (*DisableTable) Serialize

func (dt *DisableTable) Serialize() ([]byte, error)

Serialize will convert this HBase call into a slice of bytes to be written to the network

func (*DisableTable) SetFamilies

func (to *DisableTable) SetFamilies(map[string][]string) error

SetFamilies always returns an error.

func (*DisableTable) SetFilter

func (to *DisableTable) SetFilter(filter.Filter) error

SetFilter always returns an error.

type EnableTable

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

EnableTable represents a EnableTable HBase call

func NewEnableTable

func NewEnableTable(ctx context.Context, table []byte) *EnableTable

NewEnableTable creates a new EnableTable request that will enable the given table in HBase. For use by the admin client.

func (*EnableTable) GetName

func (et *EnableTable) GetName() string

GetName returns the name of this RPC call.

func (*EnableTable) NewResponse

func (et *EnableTable) NewResponse() proto.Message

NewResponse creates an empty protobuf message to read the response of this RPC.

func (*EnableTable) Serialize

func (et *EnableTable) Serialize() ([]byte, error)

Serialize will convert this HBase call into a slice of bytes to be written to the network

func (*EnableTable) SetFamilies

func (to *EnableTable) SetFamilies(map[string][]string) error

SetFamilies always returns an error.

func (*EnableTable) SetFilter

func (to *EnableTable) SetFilter(filter.Filter) error

SetFilter always returns an error.

type Get

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

Get represents a Get HBase call.

func NewGet

func NewGet(ctx context.Context, table, key []byte,
	options ...func(Call) error) (*Get, error)

NewGet creates a new Get request for the given table and row key.

func NewGetBefore

func NewGetBefore(ctx context.Context, table, key []byte,
	options ...func(Call) error) (*Get, error)

NewGetBefore creates a new Get request for the row with a key equal to or immediately less than the given key, in the given table.

func NewGetStr

func NewGetStr(ctx context.Context, table, key string,
	options ...func(Call) error) (*Get, error)

NewGetStr creates a new Get request for the given table and row key.

func (*Get) ExistsOnly

func (g *Get) ExistsOnly() error

ExistsOnly makes this Get request not return any KeyValue, merely whether or not the given row key exists in the table.

func (*Get) GetContext

func (b *Get) GetContext() context.Context

func (*Get) GetFamilies

func (g *Get) GetFamilies() map[string][]string

GetFamilies returns the families to retrieve with this Get request.

func (*Get) GetFilter

func (g *Get) GetFilter() filter.Filter

GetFilter returns the filter of this Get request.

func (*Get) GetName

func (g *Get) GetName() string

GetName returns the name of this RPC call.

func (*Get) GetRegion

func (b *Get) GetRegion() *regioninfo.Info

func (*Get) GetResultChan

func (b *Get) GetResultChan() chan RPCResult

func (*Get) Key

func (b *Get) Key() []byte

func (*Get) NewResponse

func (g *Get) NewResponse() proto.Message

NewResponse creates an empty protobuf message to read the response of this RPC.

func (*Get) Serialize

func (g *Get) Serialize() ([]byte, error)

Serialize serializes this RPC into a buffer.

func (*Get) SetFamilies

func (g *Get) SetFamilies(f map[string][]string) error

SetFamilies sets families to retrieve with this Get request.

func (*Get) SetFilter

func (g *Get) SetFilter(f filter.Filter) error

SetFilter sets filter to use for this Get request.

func (*Get) SetRegion

func (b *Get) SetRegion(region *regioninfo.Info)

func (*Get) Table

func (b *Get) Table() []byte

type Mutate

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

Mutate represents a mutation on HBase.

func NewAppStr

func NewAppStr(ctx context.Context, table, key string,
	values map[string]map[string][]byte) (*Mutate, error)

NewAppStr creates a new Mutation request to append the given family-column-values into the existing cells in HBase (or create them if needed), in given row key of the given table.

func NewAppStrRef

func NewAppStrRef(ctx context.Context, table, key string, data interface{}) (*Mutate, error)

NewAppStrRef creates a new Mutation request that will append the given values to their existing values in HBase under the given table and key.

func NewDelStr

func NewDelStr(ctx context.Context, table, key string,
	values map[string]map[string][]byte) (*Mutate, error)

NewDelStr creates a new Mutation request to delete the given family-column-values from the given row key of the given table.

func NewDelStrRef

func NewDelStrRef(ctx context.Context, table, key string, data interface{}) (*Mutate, error)

NewDelStrRef creates a new Mutation request to delete the given data structure from the given row key of the given table. The `data' argument must be a string with fields defined using the "hbase" tag.

func NewIncStr

func NewIncStr(ctx context.Context, table, key string,
	values map[string]map[string][]byte) (*Mutate, error)

NewIncStr creates a new Mutation request that will increment the given values in HBase under the given table and key.

func NewIncStrRef

func NewIncStrRef(ctx context.Context, table, key string, data interface{}) (*Mutate, error)

NewIncStrRef creates a new Mutation request that will increment the given values in HBase under the given table and key.

func NewIncStrSingle

func NewIncStrSingle(ctx context.Context, table, key string, family string,
	qualifier string, amount int64) (*Mutate, error)

NewIncStrSingle creates a new Mutation request that will increment the given value by amount in HBase under the given table, key, family and qualifier.

func NewPutStr

func NewPutStr(ctx context.Context, table, key string,
	values map[string]map[string][]byte) (*Mutate, error)

NewPutStr creates a new Mutation request to insert the given family-column-values in the given row key of the given table.

func NewPutStrRef

func NewPutStrRef(ctx context.Context, table, key string, data interface{}) (*Mutate, error)

NewPutStrRef creates a new Mutation request to insert the given data structure in the given row key of the given table. The `data' argument must be a string with fields defined using the "hbase" tag.

func (*Mutate) GetContext

func (b *Mutate) GetContext() context.Context

func (*Mutate) GetName

func (m *Mutate) GetName() string

GetName returns the name of this RPC call.

func (*Mutate) GetRegion

func (b *Mutate) GetRegion() *regioninfo.Info

func (*Mutate) GetResultChan

func (b *Mutate) GetResultChan() chan RPCResult

func (*Mutate) Key

func (b *Mutate) Key() []byte

func (*Mutate) NewResponse

func (m *Mutate) NewResponse() proto.Message

NewResponse creates an empty protobuf message to read the response of this RPC.

func (*Mutate) Serialize

func (m *Mutate) Serialize() ([]byte, error)

Serialize converts this mutate object into a protobuf message suitable for sending to an HBase server

func (*Mutate) SetFamilies

func (m *Mutate) SetFamilies(fam map[string][]string) error

SetFamilies always returns an error when used on Mutate objects. Do not use. Exists solely so Mutate can implement the Call interface.

func (*Mutate) SetFilter

func (m *Mutate) SetFilter(ft filter.Filter) error

SetFilter always returns an error when used on Mutate objects. Do not use. Exists solely so Mutate can implement the Call interface.

func (*Mutate) SetRegion

func (b *Mutate) SetRegion(region *regioninfo.Info)

func (*Mutate) Table

func (b *Mutate) Table() []byte

type RPCResult

type RPCResult struct {
	Msg   proto.Message
	Error error
}

RPCResult is struct that will contain both the resulting message from an RPC call, and any errors that may have occurred related to making the RPC call.

type Result

type Result struct {
	Cells  []*Cell
	Exists *bool
	Stale  *bool
}

Result holds a slice of Cells as well as miscellaneous information about the response.

func ToLocalResult

func ToLocalResult(pbr *pb.Result) *Result

ToLocalResult takes a protobuf Result type and converts it to our own Result type in constant time.

type Scan

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

Scan represents a scanner on an HBase table.

func NewCloseFromID

func NewCloseFromID(ctx context.Context, table []byte,
	scannerID uint64, startRow []byte) *Scan

NewCloseFromID creates a new Scan request that will close the scanner for the given scanner ID. This is an internal method, users are not expected to deal with scanner IDs.

func NewScan

func NewScan(ctx context.Context, table []byte, options ...func(Call) error) (*Scan, error)

NewScan creates a scanner for the given table.

func NewScanFromID

func NewScanFromID(ctx context.Context, table []byte,
	scannerID uint64, startRow []byte) *Scan

NewScanFromID creates a new Scan request that will return additional results from the given scanner ID. This is an internal method, users are not expected to deal with scanner IDs.

func NewScanRange

func NewScanRange(ctx context.Context, table, startRow, stopRow []byte,
	options ...func(Call) error) (*Scan, error)

NewScanRange creates a scanner for the given table and key range. The range is half-open, i.e. [startRow; stopRow[ -- stopRow is not included in the range.

func NewScanRangeStr

func NewScanRangeStr(ctx context.Context, table, startRow, stopRow string,
	options ...func(Call) error) (*Scan, error)

NewScanRangeStr creates a scanner for the given table and key range. The range is half-open, i.e. [startRow; stopRow[ -- stopRow is not included in the range.

func NewScanStr

func NewScanStr(ctx context.Context, table string, options ...func(Call) error) (*Scan, error)

NewScanStr creates a scanner for the given table.

func (*Scan) GetContext

func (b *Scan) GetContext() context.Context

func (*Scan) GetFamilies

func (s *Scan) GetFamilies() map[string][]string

GetFamilies returns the set families covered by this scanner. If no families are specified then all the families are scanned.

func (*Scan) GetFilter

func (s *Scan) GetFilter() filter.Filter

GetFilter returns the filter set on this scanner.

func (*Scan) GetName

func (s *Scan) GetName() string

GetName returns the name of this RPC call.

func (*Scan) GetRegion

func (b *Scan) GetRegion() *regioninfo.Info

func (*Scan) GetRegionStop

func (s *Scan) GetRegionStop() []byte

GetRegionStop returns the stop key of the region currently being scanned. This is an internal method, end users are not expected to use it.

func (*Scan) GetResultChan

func (b *Scan) GetResultChan() chan RPCResult

func (*Scan) GetStartRow

func (s *Scan) GetStartRow() []byte

GetStartRow returns the start key (inclusive) of this scanner.

func (*Scan) GetStopRow

func (s *Scan) GetStopRow() []byte

GetStopRow returns the end key (exclusive) of this scanner.

func (*Scan) Key

func (b *Scan) Key() []byte

func (*Scan) NewResponse

func (s *Scan) NewResponse() proto.Message

NewResponse creates an empty protobuf message to read the response of this RPC.

func (*Scan) Serialize

func (s *Scan) Serialize() ([]byte, error)

Serialize converts this Scan into a serialized protobuf message ready to be sent to an HBase node.

func (*Scan) SetFamilies

func (s *Scan) SetFamilies(fam map[string][]string) error

SetFamilies sets the families covered by this scanner.

func (*Scan) SetFilter

func (s *Scan) SetFilter(ft filter.Filter) error

SetFilter sets the request's filter.

func (*Scan) SetRegion

func (b *Scan) SetRegion(region *regioninfo.Info)

func (*Scan) Table

func (b *Scan) Table() []byte

Jump to

Keyboard shortcuts

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