hrpc

package
v0.0.0-...-dd4f14f Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 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 is called to construct a Get* object which is then passed as the sole parameter for a client.Get(). Uses functional options for arguments, for more information see - http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis Allows usage like the following -

get, err := hrpc.NewGet(ctx, table, key)
get, err := hrpc.NewGet(ctx, table, key, hrpc.Families(fam))
get, err := hrpc.NewGet(ctx, table, key, hrpc.Filters(filter))
get, err := hrpc.NewGet(ctx, table, key, hrpc.Families(fam), hrpc.Filters(filter))

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 right before the given key in the given table and family. Accepts functional options.

func NewGetStr

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

NewGetStr wraps NewGet to allow string table names and keys.

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 current set family

func (*Get) GetFilter

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

GetFilter returns current set filter

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 use and returns the object

func (*Get) SetFilter

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

SetFilter sets filter to use and returns the object

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 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 that will delete the given values from HBase under the given table and key.

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 NewPutStr

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

NewPutStr creates a new Mutation request that will put the given values into HBase under the given table and key.

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 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 scan for a given scanner ID.

func NewScan

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

NewScan is called to construct a Scan* object which is then passed as the sole parameter for a client.Scan(). Uses functional options for arguments, see http://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis for more information.

Allows usage like the following -

scan, err := hrpc.NewScan(ctx, table)
scan, err := hrpc.NewScan(ctx, table, hrpc.Families(fam))
scan, err := hrpc.NewScan(ctx, table, hrpc.Filters(filter))
scan, err := hrpc.NewScan(ctx, table, hrpc.Families(fam), hrpc.Filters(filter))

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 a given scanner ID.

func NewScanRange

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

NewScanRange is equivalent to NewScan but adds two additional parameters - startRow, stopRow. This allows a range to be scanned without having to go through the overhead of using a RowFilter

func NewScanRangeStr

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

NewScanRangeStr wraps NewScanRange but allows table, startRow, stopRow to be specified as strings

func NewScanStr

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

NewScanStr wraps NewScan but allows the table to be specified as a string.

func (*Scan) GetContext

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

func (*Scan) GetFamilies

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

GetFamilies returns the set families.

func (*Scan) GetFilter

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

GetFilter returns the set filter.

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.

func (*Scan) GetResultChan

func (b *Scan) GetResultChan() chan RPCResult

func (*Scan) GetStartRow

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

GetStartRow returns the set startRow.

func (*Scan) GetStopRow

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

GetStopRow returns the set stopRow.

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 will convert 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 request's families.

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