hrpc

package
v0.0.0-...-9c19712 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// DefaultMaxVersions defualt value for maximum versions to return for scan queries
	DefaultMaxVersions uint32 = 1
	// MinTimestamp default value for minimum timestamp for scan queries
	MinTimestamp uint64 = 0
	// MaxTimestamp default value for maximum timestamp for scan queries
	MaxTimestamp = math.MaxUint64
	// DefaultMaxResultSize Maximum number of bytes fetched when calling a scanner's
	// next method. The default value is 2MB, which is good for 1ge networks.
	// With faster and/or high latency networks this value should be increased.
	DefaultMaxResultSize = 2097152
	// DefaultNumberOfRows is default maximum number of rows fetched by scanner
	DefaultNumberOfRows = math.MaxInt32
	// DefaultMaxResultsPerColumnFamily is the default max number of cells fetched
	// per column family for each row
	DefaultMaxResultsPerColumnFamily = math.MaxInt32
)

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

	AttributeNameTTL = "_ttl"
)

Functions

func AllowPartialResults

func AllowPartialResults() func(Call) error

AllowPartialResults is an option for scan requests. This option should be provided if the client has really big rows and wants to avoid OOM errors on her side. With this option provided, Next() will return partial rows.

func Durability

func Durability(d DurabilityType) func(Call) error

Durability sets durability for mutation queries.

func Families

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

Families option adds families constraint to a Scan or Get request.

func Filters

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

Filters option adds filters constraint to a Scan or Get request.

func MaxResultSize

func MaxResultSize(n uint64) func(Call) error

MaxResultSize is an option for scan requests. Maximum number of bytes fetched when calling a scanner's next method. MaxResultSize takes priority over NumberOfRows.

func MaxResultsPerColumnFamily

func MaxResultsPerColumnFamily(maxresults uint32) func(Call) error

MaxResultsPerColumnFamily is an option for Get or Scan requests that sets the maximum number of cells returned per column family in a row.

func MaxVersions

func MaxVersions(versions uint32) func(Call) error

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

func NumberOfRows

func NumberOfRows(n uint32) func(Call) error

NumberOfRows is an option for scan requests. Specifies how many rows are fetched with each request to regionserver. Should be > 0, avoid extremely low values such as 1 because a request to regionserver will be made for every row.

func ResultOffset

func ResultOffset(offset uint32) func(Call) error

ResultOffset is a option for Scan or Get requests that sets the offset for cells within a column family.

func SetBlockCache

func SetBlockCache(bc bool) func(Call) error

func SetCaching

func SetCaching(n uint32) func(Call) error

func SkipBatch

func SkipBatch() func(Call) error

SkipBatch is an option for batchable requests (Get and Mutate) to tell the client to skip batching and just send the request to Region Server right away.

func SplitKeys

func SplitKeys(sk [][]byte) func(*CreateTable)

SplitKeys will return an option that will set the split keys for the created table

func TTL

func TTL(t time.Duration) func(Call) error

TTL sets a time to live for mutation queries.

func TimeRange

func TimeRange(from, to time.Time) func(Call) error

TimeRange is used as a parameter for request creation. Adds TimeRange constraint to a request. It will get values in range [from, to[ ('to' is exclusive).

func TimeRangeUint64

func TimeRangeUint64(from, to uint64) func(Call) error

TimeRangeUint64 is used as a parameter for request creation. Adds TimeRange constraint to a request. from and to should be in milliseconds // It will get values in range [from, to[ ('to' is exclusive).

func Timestamp

func Timestamp(ts time.Time) func(Call) error

Timestamp sets timestamp for mutation queries.

Types

type Batchable

type Batchable interface {
	// SkipBatch returns true if a call shouldn't be batched into MultiRequest and
	// should be sent right away.
	SkipBatch() bool
	// contains filtered or unexported methods
}

Batchable interface should be implemented by calls that can be batched into MultiRequest

type Call

type Call interface {
	Table() []byte
	Name() string
	Key() []byte
	Region() RegionInfo
	SetRegion(region RegionInfo)
	ToProto() (proto.Message, error)
	// Returns a newly created (default-state) protobuf in which to store the
	// response of this call.
	NewResponse() proto.Message
	ResultChan() chan RPCResult
	Context() context.Context
}

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 CheckAndPut

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

CheckAndPut performs a provided Put operation if the value specified by condition equals to the one set in the HBase.

func NewCheckAndPut

func NewCheckAndPut(put *Mutate, family string,
	qualifier string, expectedValue []byte) (*CheckAndPut, error)

NewCheckAndPut creates a new CheckAndPut request that will compare provided expectedValue with the on in HBase located at put's row and provided family:qualifier, and if they are equal, perform the provided put request on the row

func (CheckAndPut) Context

func (b CheckAndPut) Context() context.Context

func (CheckAndPut) Key

func (b CheckAndPut) Key() []byte

func (CheckAndPut) Region

func (b CheckAndPut) Region() RegionInfo

func (CheckAndPut) ResultChan

func (b CheckAndPut) ResultChan() chan RPCResult

func (CheckAndPut) SetRegion

func (b CheckAndPut) SetRegion(region RegionInfo)

func (CheckAndPut) Table

func (b CheckAndPut) Table() []byte

func (*CheckAndPut) ToProto

func (cp *CheckAndPut) ToProto() (proto.Message, error)

ToProto converts the RPC into a protobuf message

type ClusterStatus

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

ClusterStatus to represent a cluster status request

func NewClusterStatus

func NewClusterStatus() *ClusterStatus

NewClusterStatus creates a new ClusterStatusStruct with default fields

func (*ClusterStatus) Context

func (b *ClusterStatus) Context() context.Context

func (*ClusterStatus) Key

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

func (*ClusterStatus) Name

func (c *ClusterStatus) Name() string

Name returns the name of the rpc function

func (*ClusterStatus) NewResponse

func (c *ClusterStatus) NewResponse() proto.Message

NewResponse returns the empty protobuf response

func (*ClusterStatus) Region

func (b *ClusterStatus) Region() RegionInfo

func (*ClusterStatus) ResultChan

func (b *ClusterStatus) ResultChan() chan RPCResult

func (*ClusterStatus) SetRegion

func (b *ClusterStatus) SetRegion(region RegionInfo)

func (*ClusterStatus) Table

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

func (*ClusterStatus) ToProto

func (c *ClusterStatus) ToProto() (proto.Message, error)

ToProto returns the Protobuf message to be sent

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,
	families map[string]map[string]string,
	options ...func(*CreateTable)) *CreateTable

NewCreateTable creates a new CreateTable request that will create the given table in HBase. 'families' is a map of column family name to its attributes. For use by the admin client.

func (*CreateTable) Context

func (b *CreateTable) Context() context.Context

func (*CreateTable) Key

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

func (*CreateTable) Name

func (ct *CreateTable) Name() string

Name 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) Region

func (b *CreateTable) Region() RegionInfo

func (*CreateTable) ResultChan

func (b *CreateTable) ResultChan() chan RPCResult

func (*CreateTable) SetRegion

func (b *CreateTable) SetRegion(region RegionInfo)

func (*CreateTable) Table

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

func (*CreateTable) ToProto

func (ct *CreateTable) ToProto() (proto.Message, error)

ToProto converts the RPC into a protobuf message

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

func (b *DeleteTable) Context() context.Context

func (*DeleteTable) Key

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

func (*DeleteTable) Name

func (dt *DeleteTable) Name() string

Name 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) Region

func (b *DeleteTable) Region() RegionInfo

func (*DeleteTable) ResultChan

func (b *DeleteTable) ResultChan() chan RPCResult

func (*DeleteTable) SetRegion

func (b *DeleteTable) SetRegion(region RegionInfo)

func (*DeleteTable) Table

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

func (*DeleteTable) ToProto

func (dt *DeleteTable) ToProto() (proto.Message, error)

ToProto converts the RPC into a protobuf message

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

func (b *DisableTable) Context() context.Context

func (*DisableTable) Key

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

func (*DisableTable) Name

func (dt *DisableTable) Name() string

Name 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) Region

func (b *DisableTable) Region() RegionInfo

func (*DisableTable) ResultChan

func (b *DisableTable) ResultChan() chan RPCResult

func (*DisableTable) SetRegion

func (b *DisableTable) SetRegion(region RegionInfo)

func (*DisableTable) Table

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

func (*DisableTable) ToProto

func (dt *DisableTable) ToProto() (proto.Message, error)

ToProto converts the RPC into a protobuf message

type DurabilityType

type DurabilityType int32

DurabilityType is used to set durability for Durability option

const (
	// UseDefault is USER_DEFAULT
	UseDefault DurabilityType = iota
	// SkipWal is SKIP_WAL
	SkipWal
	// AsyncWal is ASYNC_WAL
	AsyncWal
	// SyncWal is SYNC_WAL
	SyncWal
	// FsyncWal is FSYNC_WAL
	FsyncWal
)

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

func (b *EnableTable) Context() context.Context

func (*EnableTable) Key

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

func (*EnableTable) Name

func (et *EnableTable) Name() string

Name 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) Region

func (b *EnableTable) Region() RegionInfo

func (*EnableTable) ResultChan

func (b *EnableTable) ResultChan() chan RPCResult

func (*EnableTable) SetRegion

func (b *EnableTable) SetRegion(region RegionInfo)

func (*EnableTable) Table

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

func (*EnableTable) ToProto

func (et *EnableTable) ToProto() (proto.Message, error)

ToProto converts the RPC into a protobuf message

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

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

func (*Get) DeserializeCellBlocks

func (g *Get) DeserializeCellBlocks(m proto.Message, b []byte) (uint32, error)

DeserializeCellBlocks deserializes get result from cell blocks

func (*Get) ExistsOnly

func (g *Get) ExistsOnly()

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

func (*Get) Families

func (bq *Get) Families() map[string][]string

Families returns the set families covered by this query.

func (*Get) Filter

func (bq *Get) Filter() filter.Filter

Filter returns filter of this query.

func (*Get) Key

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

func (*Get) MaxResultsPerColumnFamily

func (bq *Get) MaxResultsPerColumnFamily() uint32

MaxResultsPerColumnFamily returns the maximum number of columns to be returned per row.

func (*Get) MaxVersions

func (bq *Get) MaxVersions() uint32

MaxVersions returns max versions of this query.

func (*Get) Name

func (g *Get) Name() string

Name returns the name of this RPC call.

func (*Get) NewResponse

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

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

func (*Get) Region

func (b *Get) Region() RegionInfo

func (*Get) ResultChan

func (b *Get) ResultChan() chan RPCResult

func (*Get) ResultOffset

func (bq *Get) ResultOffset() uint32

ResultOffset returns the column offset to be returned per row.

func (*Get) SetRegion

func (b *Get) SetRegion(region RegionInfo)

func (*Get) SkipBatch

func (g *Get) SkipBatch() bool

SkipBatch returns true if the Get request shouldn't be batched, but should be sent to Region Server right away.

func (*Get) Table

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

func (*Get) TimeRange

func (bq *Get) TimeRange() (uint64, uint64)

TimeRange returns to and from timestamps of this query.

func (*Get) ToProto

func (g *Get) ToProto() (proto.Message, error)

ToProto converts this RPC into a protobuf message.

type GetProcedureState

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

GetProcedureState represents a call to HBase to check status of a procedure

func NewGetProcedureState

func NewGetProcedureState(ctx context.Context, procID uint64) *GetProcedureState

NewGetProcedureState creates a new GetProcedureState request. For use by the admin client.

func (*GetProcedureState) Context

func (b *GetProcedureState) Context() context.Context

func (*GetProcedureState) Key

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

func (*GetProcedureState) Name

func (ps *GetProcedureState) Name() string

Name returns the name of this RPC call.

func (*GetProcedureState) NewResponse

func (ps *GetProcedureState) NewResponse() proto.Message

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

func (*GetProcedureState) Region

func (b *GetProcedureState) Region() RegionInfo

func (*GetProcedureState) ResultChan

func (b *GetProcedureState) ResultChan() chan RPCResult

func (*GetProcedureState) SetRegion

func (b *GetProcedureState) SetRegion(region RegionInfo)

func (*GetProcedureState) Table

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

func (*GetProcedureState) ToProto

func (ps *GetProcedureState) ToProto() (proto.Message, error)

ToProto converts the RPC into a protobuf message

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, options ...func(Call) error) (*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{},
	options ...func(Call) error) (*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, options ...func(Call) error) (*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{},
	options ...func(Call) error) (*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, options ...func(Call) error) (*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{},
	options ...func(Call) error) (*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, options ...func(Call) error) (*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, options ...func(Call) error) (*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{},
	options ...func(Call) error) (*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) Context

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

func (*Mutate) DeserializeCellBlocks

func (m *Mutate) DeserializeCellBlocks(pm proto.Message, b []byte) (uint32, error)

DeserializeCellBlocks deserializes mutate result from cell blocks

func (*Mutate) Key

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

func (*Mutate) Name

func (m *Mutate) Name() string

Name returns the name of this RPC call.

func (*Mutate) NewResponse

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

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

func (*Mutate) Region

func (b *Mutate) Region() RegionInfo

func (*Mutate) ResultChan

func (b *Mutate) ResultChan() chan RPCResult

func (*Mutate) SetRegion

func (b *Mutate) SetRegion(region RegionInfo)

func (*Mutate) SkipBatch

func (m *Mutate) SkipBatch() bool

SkipBatch returns true if the Mutate request shouldn't be batched, but should be sent to Region Server right away.

func (*Mutate) Table

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

func (*Mutate) ToProto

func (m *Mutate) ToProto() (proto.Message, error)

ToProto converts this mutate RPC into a protobuf message

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 RegionClient

type RegionClient interface {
	Close()
	Addr() string
	QueueRPC(Call)
	String() string
	IsDone() bool
}

RegionClient represents HBase region client.

type RegionInfo

type RegionInfo interface {
	IsUnavailable() bool
	AvailabilityChan() <-chan struct{}
	MarkUnavailable() bool
	MarkAvailable()
	MarkDead()
	Context() context.Context
	String() string
	ID() uint64
	Name() []byte
	StartKey() []byte
	StopKey() []byte
	Namespace() []byte
	Table() []byte
	SetClient(RegionClient)
	Client() RegionClient
}

RegionInfo represents HBase region.

type Result

type Result struct {
	Cells   []*Cell
	Stale   bool
	Partial bool
	// Exists is only set if existance_only was set in the request query.
	Exists *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 NewPrefixScanStr

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

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

func (s *Scan) AllowPartialResults() bool

AllowPartialResults returns true if client handles partials.

func (*Scan) Context

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

func (*Scan) DeserializeCellBlocks

func (s *Scan) DeserializeCellBlocks(m proto.Message, b []byte) (uint32, error)

DeserializeCellBlocks deserializes scan results from cell blocks

func (*Scan) Families

func (bq *Scan) Families() map[string][]string

Families returns the set families covered by this query.

func (*Scan) Filter

func (bq *Scan) Filter() filter.Filter

Filter returns filter of this query.

func (*Scan) IsClosing

func (s *Scan) IsClosing() bool

IsClosing returns wether this scan closes scanner prematurely

func (*Scan) Key

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

func (*Scan) MaxResultSize

func (s *Scan) MaxResultSize() uint64

MaxResultSize returns Maximum number of bytes fetched when calling a scanner's next method.

func (*Scan) MaxResultsPerColumnFamily

func (bq *Scan) MaxResultsPerColumnFamily() uint32

MaxResultsPerColumnFamily returns the maximum number of columns to be returned per row.

func (*Scan) MaxVersions

func (bq *Scan) MaxVersions() uint32

MaxVersions returns max versions of this query.

func (*Scan) Name

func (s *Scan) Name() string

Name returns the name of this RPC call.

func (*Scan) NewResponse

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

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

func (*Scan) NumberOfRows

func (s *Scan) NumberOfRows() uint32

NumberOfRows returns maximum number of rows that will be fetched with each scan request to regionserver.

func (*Scan) Region

func (b *Scan) Region() RegionInfo

func (*Scan) ResultChan

func (b *Scan) ResultChan() chan RPCResult

func (*Scan) ResultOffset

func (bq *Scan) ResultOffset() uint32

ResultOffset returns the column offset to be returned per row.

func (*Scan) SetRegion

func (b *Scan) SetRegion(region RegionInfo)

func (*Scan) StartRow

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

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

func (*Scan) StopRow

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

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

func (*Scan) String

func (s *Scan) String() string

func (*Scan) Table

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

func (*Scan) TimeRange

func (bq *Scan) TimeRange() (uint64, uint64)

TimeRange returns to and from timestamps of this query.

func (*Scan) ToProto

func (s *Scan) ToProto() (proto.Message, error)

ToProto converts this Scan into a protobuf message

type Scanner

type Scanner interface {
	// Next returns a row at a time.
	// Once all rows are returned, subsequent calls will return nil and io.EOF.
	//
	// In case of an error or Close() was called, only the first call to Next() will
	// return partial result (could be not a complete row) and the actual error,
	// the subsequent calls will return nil and io.EOF.
	//
	// In case a scan rpc has an expired context, partial result and io.EOF will be
	// returned. Clients should check the error of the context they passed if they
	// want to if the scanner was closed because of the deadline.
	//
	// This method is thread safe.
	Next() (*Result, error)

	// Close should be called if it is desired to stop scanning before getting all of results.
	// If you call Next() after calling Close() you might still get buffered results.
	// Othwerwise, in case all results have been delivered or in case of an error, the Scanner
	// will be closed automatically.
	Close() error
}

Scanner is used to read data sequentially from HBase. Scanner will be automatically closed if there's no more data to read, otherwise Close method should be called.

Jump to

Keyboard shortcuts

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