Documentation ¶
Index ¶
- Constants
- Variables
- func Durability(d DurabilityType) func(Call) error
- func Families(fam map[string][]string) func(Call) error
- func Filters(fl filter.Filter) func(Call) error
- func MaxVersions(versions uint32) func(Call) error
- func NumberOfRows(n uint32) func(Call) error
- func TimeRange(from, to time.Time) func(Call) error
- func TimeRangeUint64(from, to uint64) func(Call) error
- func Timestamp(ts time.Time) func(Call) error
- type Call
- type Cell
- type CheckAndPut
- func (b CheckAndPut) Context() context.Context
- func (b CheckAndPut) Key() []byte
- func (b CheckAndPut) Region() RegionInfo
- func (b CheckAndPut) ResultChan() chan RPCResult
- func (cas *CheckAndPut) Serialize() ([]byte, error)
- func (b CheckAndPut) SetRegion(region RegionInfo)
- func (b CheckAndPut) Table() []byte
- type CreateTable
- type DeleteTable
- type DisableTable
- type DurabilityType
- type EnableTable
- type Get
- func (b *Get) Context() context.Context
- func (g *Get) ExistsOnly() error
- func (g *Get) Families() map[string][]string
- func (g *Get) Filter() filter.Filter
- func (b *Get) Key() []byte
- func (g *Get) Name() string
- func (g *Get) NewResponse() proto.Message
- func (b *Get) Region() RegionInfo
- func (b *Get) ResultChan() chan RPCResult
- func (g *Get) Serialize() ([]byte, error)
- func (g *Get) SetFamilies(f map[string][]string) error
- func (g *Get) SetFilter(f filter.Filter) error
- func (b *Get) SetRegion(region RegionInfo)
- func (b *Get) Table() []byte
- type GetProcedureState
- func (b *GetProcedureState) Context() context.Context
- func (b *GetProcedureState) Key() []byte
- func (ps *GetProcedureState) Name() string
- func (ps *GetProcedureState) NewResponse() proto.Message
- func (b *GetProcedureState) Region() RegionInfo
- func (b *GetProcedureState) ResultChan() chan RPCResult
- func (ps *GetProcedureState) Serialize() ([]byte, error)
- func (ps *GetProcedureState) SetFamilies(map[string][]string) error
- func (ps *GetProcedureState) SetFilter(filter.Filter) error
- func (b *GetProcedureState) SetRegion(region RegionInfo)
- func (b *GetProcedureState) Table() []byte
- type Mutate
- func NewAppStr(ctx context.Context, table, key string, values map[string]map[string][]byte, ...) (*Mutate, error)
- func NewAppStrRef(ctx context.Context, table, key string, data interface{}, ...) (*Mutate, error)
- func NewDelStr(ctx context.Context, table, key string, values map[string]map[string][]byte, ...) (*Mutate, error)
- func NewDelStrRef(ctx context.Context, table, key string, data interface{}, ...) (*Mutate, error)
- func NewIncStr(ctx context.Context, table, key string, values map[string]map[string][]byte, ...) (*Mutate, error)
- func NewIncStrRef(ctx context.Context, table, key string, data interface{}, ...) (*Mutate, error)
- func NewIncStrSingle(ctx context.Context, table, key string, family string, qualifier string, ...) (*Mutate, error)
- func NewPutStr(ctx context.Context, table, key string, values map[string]map[string][]byte, ...) (*Mutate, error)
- func NewPutStrRef(ctx context.Context, table, key string, data interface{}, ...) (*Mutate, error)
- func (b *Mutate) Context() context.Context
- func (b *Mutate) Key() []byte
- func (m *Mutate) Name() string
- func (m *Mutate) NewResponse() proto.Message
- func (b *Mutate) Region() RegionInfo
- func (b *Mutate) ResultChan() chan RPCResult
- func (m *Mutate) Serialize() ([]byte, error)
- func (m *Mutate) SetFamilies(fam map[string][]string) error
- func (m *Mutate) SetFilter(ft filter.Filter) error
- func (b *Mutate) SetRegion(region RegionInfo)
- func (b *Mutate) Table() []byte
- type RPCResult
- type RegionClient
- type RegionInfo
- type Result
- type Scan
- func NewCloseFromID(ctx context.Context, table []byte, scannerID uint64, startRow []byte) *Scan
- func NewScan(ctx context.Context, table []byte, options ...func(Call) error) (*Scan, error)
- func NewScanFromID(ctx context.Context, table []byte, scannerID uint64, startRow []byte) *Scan
- func NewScanRange(ctx context.Context, table, startRow, stopRow []byte, ...) (*Scan, error)
- func NewScanRangeStr(ctx context.Context, table, startRow, stopRow string, ...) (*Scan, error)
- func NewScanStr(ctx context.Context, table string, options ...func(Call) error) (*Scan, error)
- func (b *Scan) Context() context.Context
- func (s *Scan) Families() map[string][]string
- func (s *Scan) Filter() filter.Filter
- func (b *Scan) Key() []byte
- func (s *Scan) MaxVersions() uint32
- func (s *Scan) Name() string
- func (s *Scan) NewResponse() proto.Message
- func (s *Scan) NumberOfRows() uint32
- func (b *Scan) Region() RegionInfo
- func (s *Scan) RegionStop() []byte
- func (b *Scan) ResultChan() chan RPCResult
- func (s *Scan) Serialize() ([]byte, error)
- func (s *Scan) SetFamilies(fam map[string][]string) error
- func (s *Scan) SetFilter(ft filter.Filter) error
- func (b *Scan) SetRegion(region RegionInfo)
- func (s *Scan) StartRow() []byte
- func (s *Scan) StopRow() []byte
- func (b *Scan) Table() []byte
- func (s *Scan) TimeRange() (uint64, uint64)
Constants ¶
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 // DefaultNumberOfRows is default maximum number of rows fetched by scanner DefaultNumberOfRows = 128 )
Variables ¶
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 Durability ¶
func Durability(d DurabilityType) func(Call) error
Durability sets durability for mutation queries.
func Families ¶
Families is used as a parameter for request creation. Adds families constraint to a request.
func Filters ¶
Filters is used as a parameter for request creation. Adds filters constraint to a request.
func MaxVersions ¶
MaxVersions is used as a parameter for request creation. Adds MaxVersions constraint to a request.
func NumberOfRows ¶
NumberOfRows is used as a parameter for request creation. Adds NumberOfRows constraint to a request.
func TimeRange ¶
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 ¶
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).
Types ¶
type Call ¶
type Call interface { Table() []byte Name() string Key() []byte Region() RegionInfo SetRegion(region RegionInfo) Serialize() ([]byte, 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 SetFamilies(fam map[string][]string) error SetFilter(ft filter.Filter) error }
Call represents an HBase RPC call.
type 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) Region ¶
func (b CheckAndPut) Region() RegionInfo
func (CheckAndPut) ResultChan ¶
func (b CheckAndPut) ResultChan() chan RPCResult
func (*CheckAndPut) Serialize ¶
func (cas *CheckAndPut) Serialize() ([]byte, error)
Serialize converts this mutate object into a protobuf message suitable for sending to an HBase server
func (CheckAndPut) SetRegion ¶
func (b CheckAndPut) SetRegion(region RegionInfo)
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) *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) 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) 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 ¶
SetFamilies 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) 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) 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 ¶
SetFamilies 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) 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) 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 ¶
SetFamilies always returns an error.
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) 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) 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 ¶
SetFamilies always returns an error.
type Get ¶
type Get struct {
// contains filtered or unexported fields
}
Get represents a Get HBase call.
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 (*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) NewResponse ¶
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) SetFamilies ¶
SetFamilies sets families to retrieve with this Get request.
func (*Get) SetRegion ¶
func (b *Get) SetRegion(region RegionInfo)
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) 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) Serialize ¶
func (ps *GetProcedureState) Serialize() ([]byte, error)
Serialize will convert this HBase call into a slice of bytes to be written to the network
func (*GetProcedureState) SetFamilies ¶
func (ps *GetProcedureState) SetFamilies(map[string][]string) error
SetFamilies always returns an error.
func (*GetProcedureState) SetFilter ¶
func (ps *GetProcedureState) SetFilter(filter.Filter) error
SetFilter always returns an error.
func (*GetProcedureState) SetRegion ¶
func (b *GetProcedureState) SetRegion(region RegionInfo)
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) NewResponse ¶
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) Serialize ¶
Serialize converts this mutate object into a protobuf message suitable for sending to an HBase server
func (*Mutate) SetFamilies ¶
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 ¶
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)
type RPCResult ¶
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 ¶
RegionClient represents HBase region client.
type RegionInfo ¶
type RegionInfo interface { AvailabilityChan() <-chan struct{} MarkAvailable() String() string Name() []byte StartKey() []byte StopKey() []byte Table() []byte SetClient(RegionClient) Client() RegionClient }
RegionInfo represents HBase region.
type Result ¶
Result holds a slice of Cells as well as miscellaneous information about the response.
func ToLocalResult ¶
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 ¶
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 NewScanFromID ¶
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 ¶
NewScanStr creates a scanner for the given table.
func (*Scan) Families ¶
Families returns the set families covered by this scanner. If no families are specified then all the families are scanned.
func (*Scan) MaxVersions ¶
MaxVersions returns the max versions set on this scanner.
func (*Scan) NewResponse ¶
NewResponse creates an empty protobuf message to read the response of this RPC.
func (*Scan) NumberOfRows ¶
NumberOfRows returns maximum number of rows that could be fetched by this scanner.
func (*Scan) Region ¶
func (b *Scan) Region() RegionInfo
func (*Scan) RegionStop ¶
RegionStop 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) ResultChan ¶
func (b *Scan) ResultChan() chan RPCResult
func (*Scan) Serialize ¶
Serialize converts this Scan into a serialized protobuf message ready to be sent to an HBase node.
func (*Scan) SetFamilies ¶
SetFamilies sets the families covered by this scanner.
func (*Scan) SetRegion ¶
func (b *Scan) SetRegion(region RegionInfo)