hbase

package module
v0.0.0-...-5899e70 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 10 Imported by: 0

README

hbase-go

Hbase(thrift2) SDK for golang

Advantages:

  • No need to compile with thrift by yourself
  • Manager by go module
  • Keep update and easy to use

Installation

go get github.com/geange/hbase-go

Example

create client
import hb "github.com/geange/hbase-go"

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
client, err := hb.NewRawClient(ctx, hb.RawClientOption{
    Host:       "127.0.0.1",
    Port:       9090,
    BufferSize: 8192,
})
if err != nil {
    panic(err)
}

if err := client.Open(); err != nil {
    panic(err)
}
Insert a cell
table := []byte("demo")
err = client.Put(context.Background(), table, &hbase.TPut{
    Row: []byte("abc"),
    ColumnValues: []*hbase.TColumnValue{&hbase.TColumnValue{
        Family:    []byte("d"),
        Qualifier: []byte("001"),
        Value:     []byte("1234567890"),
    }},
})
Get an entire row
table := []byte("demo")

result, err := client.Get(context.Background(), table, &hbase.TGet{
    Row: []byte("abc"),
})
if err != nil {
    panic(err)
}

for _, v := range result.ColumnValues {
    fmt.Println(string(v.Family), string(v.Qualifier), string(v.Value))
}
Get a special cell
family := []byte("d")
qualifier := []byte("001")
result, err := client.Get(context.Background(), table, &hbase.TGet{
    Row: []byte("abc"),
    Columns: []*hbase.TColumn{&hbase.TColumn{
        Family:    family,
        Qualifier: qualifier,
    }},
})
Get a specific cell with a filter
result, err := client.Get(context.Background(), table, &hbase.TGet{
    Row: []byte("abc"),
    Columns: []*hbase.TColumn{&hbase.TColumn{
        Family:    []byte("d"),
        Qualifier: []byte("001"),
    }},
    FilterString: []byte("PrefixFilter ('ab')"),
})

Documentation

Index

Constants

View Source
const (
	Binary       = ComparatorType("binary")
	BinaryPrefix = ComparatorType("binaryprefix")
	RegexString  = ComparatorType("regexstring")
	SubString    = ComparatorType("substring")
)
View Source
const (
	LESS             = CompareOp("<")
	LESS_OR_EQUAL    = CompareOp("<=")
	EQUAL            = CompareOp("=")
	NOT_EQUAL        = CompareOp("!=")
	GREATER_OR_EQUAL = CompareOp(">=")
	GREATER          = CompareOp(">")
	NO_OP            = CompareOp("")
)
View Source
const (
	TypeKeyOnlyFilter                  = "KeyOnlyFilter"
	TypeFirstKeyOnlyFilter             = "FirstKeyOnlyFilter"
	TypePrefixFilter                   = "PrefixFilter"
	TypeColumnPrefixFilter             = "ColumnPrefixFilter"
	TypeMultipleColumnPrefixFilter     = "MultipleColumnPrefixFilter"
	TypeColumnCountGetFilter           = "ColumnCountGetFilter"
	TypePageFilter                     = "PageFilter"
	TypeColumnPaginationFilter         = "ColumnPaginationFilter"
	TypeInclusiveStopFilter            = "InclusiveStopFilter"
	TypeTimeStampsFilter               = "TimeStampsFilter"
	TypeRowFilter                      = "RowFilter"
	TypeFamilyFilter                   = "familyFilter"
	TypeQualifierFilter                = "QualifierFilter"
	TypeValueFilter                    = "ValueFilter"
	TypeDependentColumnFilter          = "DependentColumnFilter"
	TypeSingleColumnValueFilter        = "SingleColumnValueFilter"
	TypeSingleColumnValueExcludeFilter = "SingleColumnValueExcludeFilter"
	TypeColumnRangeFilter              = "ColumnRangeFilter"
)

Variables

View Source
var (
	Thrift  = 1
	Thrift2 = 2
)
View Source
var (
	ErrorClientVersion = errors.New("client version unsupported")
)

Functions

func Int32

func Int32(num int32) *int32

func String

func String(s string) *string

func Thrift2TDataBlockEncoding

func Thrift2TDataBlockEncoding(v *TDataBlockEncoding) *thrift2.TDataBlockEncoding

func Thrift2TKeepDeletedCells

func Thrift2TKeepDeletedCells(v *TKeepDeletedCells) *thrift2.TKeepDeletedCells

Types

type Append

type Append struct {
	Row            []byte
	Columns        []*ColumnValue
	Attributes     map[string][]byte
	Durability     *TDurability
	CellVisibility *CellVisibility
	ReturnResults  *bool
}

type Authorization

type Authorization struct {
	Labels []string
}

type BinaryComparator

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

BinaryComparator: This lexicographically compares against the specified byte array using Bytes.compareTo(byte[], byte[])

func NewBinaryComparator

func NewBinaryComparator(specified string) *BinaryComparator

func (*BinaryComparator) Value

func (c *BinaryComparator) Value() string

type BinaryPrefixComparator

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

BinaryPrefixComparator: This lexicographically compares against a specified byte array. It only compares up to the length of this byte array

func NewBinaryPrefixComparator

func NewBinaryPrefixComparator(prefix string) *BinaryPrefixComparator

type CellVisibility

type CellVisibility struct {
	Expression *string
}

type Column

type Column struct {
	Family    []byte
	Qualifier []byte
	Timestamp *int64
}

type ColumnFamily

type ColumnFamily struct {
	Name          []byte
	Attributes    map[string][]byte
	Configuration map[string]string
	BlockSize     *int32
	//BloomnFilterType    *TBloomFilterType
	//CompressionType     *TCompressionAlgorithm
	DfsReplication *int16
	//DataBlockEncoding   *TDataBlockEncoding
	//KeepDeletedCells    *TKeepDeletedCells
	MaxVersions         *int32
	MinVersions         *int32
	Scope               *int32
	TimeToLive          *int32
	BlockCacheEnabled   *bool
	CacheBloomsOnWrite  *bool
	CacheDataOnWrite    *bool
	CacheIndexesOnWrite *bool
	CompressTags        *bool
	EvictBlocksOnClose  *bool
	InMemory            *bool
}

type ColumnFamilyDescriptor

type ColumnFamilyDescriptor struct {
	Name                []byte
	Attributes          map[string][]byte
	Configuration       map[string]string
	BlockSize           *int32
	BloomnFilterType    *TBloomFilterType
	CompressionType     *TCompressionAlgorithm
	DfsReplication      *int16
	DataBlockEncoding   *TDataBlockEncoding
	KeepDeletedCells    *TKeepDeletedCells
	MaxVersions         *int32
	MinVersions         *int32
	Scope               *int32
	TimeToLive          *int32
	BlockCacheEnabled   *bool
	CacheBloomsOnWrite  *bool
	CacheDataOnWrite    *bool
	CacheIndexesOnWrite *bool
	CompressTags        *bool
	EvictBlocksOnClose  *bool
	InMemory            *bool
}

type ColumnIncrement

type ColumnIncrement struct {
	Family    []byte `thrift:"family,1,required" db:"family" json:"family"`
	Qualifier []byte `thrift:"qualifier,2,required" db:"qualifier" json:"qualifier"`
	Amount    int64  `thrift:"amount,3" db:"amount" json:"amount"`
}

type ColumnValue

type ColumnValue struct {
	Family    []byte
	Qualifier []byte
	Value     []byte
	Timestamp *int64
	Tags      []byte
	Type      *int8
}

type Comparator

type Comparator interface {
	Value() string
}

type ComparatorType

type ComparatorType string

type CompareOp

type CompareOp string

Compare Operator 1. LESS (<) 2. LESS_OR_EQUAL (⇐) 3. EQUAL (=) 4. NOT_EQUAL (!=) 5. GREATER_OR_EQUAL (>=) 6. GREATER (>) 7. NO_OP (no operation)

type Delete

type Delete struct {
	Row        []byte
	Columns    []*Column
	Timestamp  *int64
	DeleteType TDeleteType
	Attributes map[string][]byte
	Durability *TDurability
}

type Filter

type Filter interface {
	FilterExpress() string
}

func AND

func AND(f1, f2 Filter) Filter

func ColumnCountGetFilter

func ColumnCountGetFilter(limit int) Filter

func ColumnPrefixFilter

func ColumnPrefixFilter(prefix string) Filter

func ColumnRangeFilter

func ColumnRangeFilter(minColumn string, minFlag bool, maxColumn string, maxFlag bool) Filter

func ColumnRangeFilterV1

func ColumnRangeFilterV1(minColumn, maxColumn string) Filter

func DependentColumnFilter

func DependentColumnFilter(family, qualifier string) Filter

func FamilyFilter

func FamilyFilter(compareOp CompareOp, comparatorType ComparatorType, comparatorValue string) Filter

func FirstKeyOnlyFilter

func FirstKeyOnlyFilter() Filter

func InclusiveStopFilter

func InclusiveStopFilter(rowKey string) Filter

func KeyOnlyFilter

func KeyOnlyFilter() Filter

func MultipleColumnPrefixFilter

func MultipleColumnPrefixFilter(prefixes []string) Filter

func OR

func OR(f1, f2 Filter) Filter

func PageFilter

func PageFilter(page int) Filter

func PrefixFilter

func PrefixFilter(prefix string) Filter

func QualifierFilter

func QualifierFilter(compareOp CompareOp, comparatorType ComparatorType, comparatorValue string) Filter

func RowFilter

func RowFilter(compareOp CompareOp, comparatorType ComparatorType, comparatorValue string) Filter

func SKIP

func SKIP(f Filter) Filter

func SingleColumnValueExcludeFilter

func SingleColumnValueExcludeFilter(family, qualifier string,
	compareOp CompareOp, comparatorType ComparatorType, comparatorValue string) Filter

func SingleColumnValueFilter

func SingleColumnValueFilter(family, qualifier string,
	compareOp CompareOp, comparatorType ComparatorType, comparatorValue string) Filter

func TimeStampsFilter

func TimeStampsFilter(timeStamps []int64) Filter

func ValueFilter

func ValueFilter(compareOp CompareOp, comparatorType ComparatorType, comparatorValue string) Filter

func WHILE

func WHILE(f Filter) Filter

type FilterType

type FilterType string

type Get

type Get struct {
	Row             []byte            `thrift:"row,1,required" db:"row" json:"row"`
	Columns         []*Column         `thrift:"columns,2" db:"columns" json:"columns,omitempty"`
	Timestamp       *int64            `thrift:"timestamp,3" db:"timestamp" json:"timestamp,omitempty"`
	TimeRange       *TimeRange        `thrift:"timeRange,4" db:"timeRange" json:"timeRange,omitempty"`
	MaxVersions     *int32            `thrift:"maxVersions,5" db:"maxVersions" json:"maxVersions,omitempty"`
	FilterString    []byte            `thrift:"filterString,6" db:"filterString" json:"filterString,omitempty"`
	Attributes      map[string][]byte `thrift:"attributes,7" db:"attributes" json:"attributes,omitempty"`
	Authorizations  *Authorization    `thrift:"authorizations,8" db:"authorizations" json:"authorizations,omitempty"`
	Consistency     *TConsistency     `thrift:"consistency,9" db:"consistency" json:"consistency,omitempty"`
	TargetReplicaId *int32            `thrift:"targetReplicaId,10" db:"targetReplicaId" json:"targetReplicaId,omitempty"`
	CacheBlocks     *bool             `thrift:"cacheBlocks,11" db:"cacheBlocks" json:"cacheBlocks,omitempty"`
	StoreLimit      *int32            `thrift:"storeLimit,12" db:"storeLimit" json:"storeLimit,omitempty"`
	StoreOffset     *int32            `thrift:"storeOffset,13" db:"storeOffset" json:"storeOffset,omitempty"`
	ExistenceOnly   *bool             `thrift:"existence_only,14" db:"existence_only" json:"existence_only,omitempty"`
	FilterBytes     []byte            `thrift:"filterBytes,15" db:"filterBytes" json:"filterBytes,omitempty"`
}

type HRegionInfo

type HRegionInfo struct {
	RegionId  int64
	TableName []byte
	StartKey  []byte
	EndKey    []byte
	Offline   *bool
	Split     *bool
	ReplicaId *int32
}

type HRegionLocation

type HRegionLocation struct {
	ServerName *ServerName
	RegionInfo *HRegionInfo
}

type Increment

type Increment struct {
	Row            []byte             `thrift:"row,1,required" db:"row" json:"row"`
	Columns        []*ColumnIncrement `thrift:"columns,2,required" db:"columns" json:"columns"`
	Attributes     map[string][]byte  `thrift:"attributes,4" db:"attributes" json:"attributes,omitempty"`
	Durability     *TDurability       `thrift:"durability,5" db:"durability" json:"durability,omitempty"`
	CellVisibility *CellVisibility    `thrift:"cellVisibility,6" db:"cellVisibility" json:"cellVisibility,omitempty"`
	ReturnResults  *bool              `thrift:"returnResults,7" db:"returnResults" json:"returnResults,omitempty"`
}

type Mutation

type Mutation struct {
	Put          *Put
	DeleteSingle *Delete
}

type Namespace

type Namespace struct {
	Name          string
	Configuration map[string]string
}

type NamespaceDescriptor

type NamespaceDescriptor struct {
	Name          string            `thrift:"name,1,required" db:"name" json:"name"`
	Configuration map[string]string `thrift:"configuration,2" db:"configuration" json:"configuration,omitempty"`
}

type Put

type Put struct {
	Row          []byte
	ColumnValues []*ColumnValue
	Timestamp    *int64
	// unused field # 4
	Attributes     map[string][]byte
	Durability     *TDurability
	CellVisibility *CellVisibility
}

type RawClientOption

type RawClientOption struct {
	Host       string
	Port       int
	BufferSize int
}

type ReadType

type ReadType int64
const (
	DEFAULT ReadType = 1
	Stream  ReadType = 2
	PRead   ReadType = 3
)

type RegexStringComparator

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

RegexStringComparator: This compares against the specified byte array using the given regular expression. Only EQUAL and NOT_EQUAL comparisons are valid with this comparator

func NewRegexStringComparator

func NewRegexStringComparator(regex string) *RegexStringComparator

type Result

type Result struct {
	Row          []byte
	ColumnValues []*ColumnValue
	Stale        bool
	Partial      bool
}

type RowMutations

type RowMutations struct {
	Row       []byte      `thrift:"row,1,required" db:"row" json:"row"`
	Mutations []*Mutation `thrift:"mutations,2,required" db:"mutations" json:"mutations"`
}

type Scan

type Scan struct {
	StartRow           []byte                `thrift:"startRow,1" db:"startRow" json:"startRow,omitempty"`
	StopRow            []byte                `thrift:"stopRow,2" db:"stopRow" json:"stopRow,omitempty"`
	Columns            []*Column             `thrift:"columns,3" db:"columns" json:"columns,omitempty"`
	Caching            *int32                `thrift:"caching,4" db:"caching" json:"caching,omitempty"`
	MaxVersions        int32                 `thrift:"maxVersions,5" db:"maxVersions" json:"maxVersions"`
	TimeRange          *TimeRange            `thrift:"timeRange,6" db:"timeRange" json:"timeRange,omitempty"`
	FilterString       []byte                `thrift:"filterString,7" db:"filterString" json:"filterString,omitempty"`
	BatchSize          *int32                `thrift:"batchSize,8" db:"batchSize" json:"batchSize,omitempty"`
	Attributes         map[string][]byte     `thrift:"attributes,9" db:"attributes" json:"attributes,omitempty"`
	Authorizations     *Authorization        `thrift:"authorizations,10" db:"authorizations" json:"authorizations,omitempty"`
	Reversed           *bool                 `thrift:"reversed,11" db:"reversed" json:"reversed,omitempty"`
	CacheBlocks        *bool                 `thrift:"cacheBlocks,12" db:"cacheBlocks" json:"cacheBlocks,omitempty"`
	ColFamTimeRangeMap map[string]*TimeRange `thrift:"colFamTimeRangeMap,13" db:"colFamTimeRangeMap" json:"colFamTimeRangeMap,omitempty"`
	ReadType           *ReadType             `thrift:"readType,14" db:"readType" json:"readType,omitempty"`
	Limit              *int32                `thrift:"limit,15" db:"limit" json:"limit,omitempty"`
	Consistency        *TConsistency         `thrift:"consistency,16" db:"consistency" json:"consistency,omitempty"`
	TargetReplicaId    *int32                `thrift:"targetReplicaId,17" db:"targetReplicaId" json:"targetReplicaId,omitempty"`
	FilterBytes        []byte                `thrift:"filterBytes,18" db:"filterBytes" json:"filterBytes,omitempty"`
}

type Scanner

type Scanner interface {
	GetScannerRows()
}

type ServerName

type ServerName struct {
	HostName  string
	Port      *int32
	StartCode *int64
}

type SubStringComparator

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

SubStringComparator: This tests if the given substring appears in a specified byte array. The comparison is case insensitive. Only EQUAL and NOT_EQUAL comparisons are valid with this comparator

func NewSubStringComparator

func NewSubStringComparator(sub string) *SubStringComparator

type TBloomFilterType

type TBloomFilterType int64
const (
	TBloomFilterType_NONE                   TBloomFilterType = 0
	TBloomFilterType_ROW                    TBloomFilterType = 1
	TBloomFilterType_ROWCOL                 TBloomFilterType = 2
	TBloomFilterType_ROWPREFIX_FIXED_LENGTH TBloomFilterType = 3
)

type TCompareOp

type TCompareOp int64
const (
	CompareOpLESS           TCompareOp = 0
	CompareOpLESSOREQUAL    TCompareOp = 1
	CompareOpEQUAL          TCompareOp = 2
	CompareOpNOTEQUAL       TCompareOp = 3
	CompareOpGREATEROREQUAL TCompareOp = 4
	CompareOpGREATER        TCompareOp = 5
	CompareOpNOOP           TCompareOp = 6
)

type TCompressionAlgorithm

type TCompressionAlgorithm int64
const (
	TCompressionAlgorithm_LZO    TCompressionAlgorithm = 0
	TCompressionAlgorithm_GZ     TCompressionAlgorithm = 1
	TCompressionAlgorithm_NONE   TCompressionAlgorithm = 2
	TCompressionAlgorithm_SNAPPY TCompressionAlgorithm = 3
	TCompressionAlgorithm_LZ4    TCompressionAlgorithm = 4
	TCompressionAlgorithm_BZIP2  TCompressionAlgorithm = 5
	TCompressionAlgorithm_ZSTD   TCompressionAlgorithm = 6
)

type TConsistency

type TConsistency int64

type TDataBlockEncoding

type TDataBlockEncoding int64
const (
	TDataBlockEncoding_NONE         TDataBlockEncoding = 0
	TDataBlockEncoding_PREFIX       TDataBlockEncoding = 2
	TDataBlockEncoding_DIFF         TDataBlockEncoding = 3
	TDataBlockEncoding_FAST_DIFF    TDataBlockEncoding = 4
	TDataBlockEncoding_ROW_INDEX_V1 TDataBlockEncoding = 7
)

type TDeleteType

type TDeleteType int64
const (
	DeleteColumn        TDeleteType = 0
	DeleteColumns       TDeleteType = 1
	DeleteFamily        TDeleteType = 2
	DeleteFamilyVersion TDeleteType = 3
)

type TDurability

type TDurability int64
const (
	UseDefault TDurability = 0
	SkipWAL    TDurability = 1
	AsyncWAL   TDurability = 2
	SyncWAL    TDurability = 3
	FsyncWAL   TDurability = 4
)

type TKeepDeletedCells

type TKeepDeletedCells int64
const (
	TKeepDeletedCells_FALSE TKeepDeletedCells = 0
	TKeepDeletedCells_TRUE  TKeepDeletedCells = 1
	TKeepDeletedCells_TTL   TKeepDeletedCells = 2
)

type TableDescriptor

type TableDescriptor struct {
	TableName  *TableName                `thrift:"tableName,1,required" db:"tableName" json:"tableName"`
	Columns    []*ColumnFamilyDescriptor `thrift:"columns,2" db:"columns" json:"columns,omitempty"`
	Attributes map[string][]byte         `thrift:"attributes,3" db:"attributes" json:"attributes,omitempty"`
	Durability *TDurability              `thrift:"durability,4" db:"durability" json:"durability,omitempty"`
}

type TableName

type TableName struct {
	Ns        []byte `thrift:"ns,1" db:"ns" json:"ns,omitempty"`
	Qualifier []byte `thrift:"qualifier,2,required" db:"qualifier" json:"qualifier"`
}

type Thrift2Client

type Thrift2Client interface {
	// open transport when client's transport closed
	Open() error
	// safeClose
	Close(ctx context.Context) error
	// Test for the existence of columns in the table, as specified in the TGet.
	//
	// @return true if the specified TGet matches one or more keys, false if not
	//
	// Parameters:
	//  - Table: the table to check on
	//  - Tget: the TGet to check for
	Exists(ctx context.Context, table []byte, tget *thrift2.TGet) (r bool, err error)
	// Test for the existence of columns in the table, as specified by the TGets.
	//
	// This will return an array of booleans. Each value will be true if the related Get matches
	// one or more keys, false if not.
	//
	// Parameters:
	//  - Table: the table to check on
	//  - Tgets: a list of TGets to check for
	ExistsAll(ctx context.Context, table []byte, tgets []*thrift2.TGet) (r []bool, err error)
	// Method for getting data from a row.
	//
	// If the row cannot be found an empty Result is returned.
	// This can be checked by the empty field of the TResult
	//
	// @return the result
	//
	// Parameters:
	//  - Table: the table to get from
	//  - Tget: the TGet to fetch
	Get(ctx context.Context, table []byte, tget *thrift2.TGet) (r *thrift2.TResult, err error)
	// Method for getting multiple rows.
	//
	// If a row cannot be found there will be a null
	// value in the result list for that TGet at the
	// same position.
	//
	// So the Results are in the same order as the TGets.
	//
	// Parameters:
	//  - Table: the table to get from
	//  - Tgets: a list of TGets to fetch, the Result list
	// will have the Results at corresponding positions
	// or null if there was an error
	GetMultiple(ctx context.Context, table []byte, tgets []*thrift2.TGet) (r []*thrift2.TResult, err error)
	// Commit a TPut to a table.
	//
	// Parameters:
	//  - Table: the table to put data in
	//  - Tput: the TPut to put
	Put(ctx context.Context, table []byte, tput *thrift2.TPut) (err error)
	// Atomically checks if a row/family/qualifier value matches the expected
	// value. If it does, it adds the TPut.
	//
	// @return true if the new put was executed, false otherwise
	//
	// Parameters:
	//  - Table: to check in and put to
	//  - Row: row to check
	//  - Family: column family to check
	//  - Qualifier: column qualifier to check
	//  - Value: the expected value, if not provided the
	// check is for the non-existence of the
	// column in question
	//  - Tput: the TPut to put if the check succeeds
	CheckAndPut(ctx context.Context, table []byte, row []byte, family []byte, qualifier []byte, value []byte, tput *thrift2.TPut) (r bool, err error)
	// Commit a List of Puts to the table.
	//
	// Parameters:
	//  - Table: the table to put data in
	//  - Tputs: a list of TPuts to commit
	PutMultiple(ctx context.Context, table []byte, tputs []*thrift2.TPut) (err error)
	// Deletes as specified by the TDelete.
	//
	// Note: "delete" is a reserved keyword and cannot be used in Thrift
	// thus the inconsistent naming scheme from the other functions.
	//
	// Parameters:
	//  - Table: the table to delete from
	//  - Tdelete: the TDelete to delete
	DeleteSingle(ctx context.Context, table []byte, tdelete *thrift2.TDelete) (err error)
	// Bulk commit a List of TDeletes to the table.
	//
	// Throws a TIOError if any of the deletes fail.
	//
	// Always returns an empty list for backwards compatibility.
	//
	// Parameters:
	//  - Table: the table to delete from
	//  - Tdeletes: list of TDeletes to delete
	DeleteMultiple(ctx context.Context, table []byte, tdeletes []*thrift2.TDelete) (r []*thrift2.TDelete, err error)
	// Atomically checks if a row/family/qualifier value matches the expected
	// value. If it does, it adds the delete.
	//
	// @return true if the new delete was executed, false otherwise
	//
	// Parameters:
	//  - Table: to check in and delete from
	//  - Row: row to check
	//  - Family: column family to check
	//  - Qualifier: column qualifier to check
	//  - Value: the expected value, if not provided the
	// check is for the non-existence of the
	// column in question
	//  - Tdelete: the TDelete to execute if the check succeeds
	CheckAndDelete(ctx context.Context, table []byte, row []byte, family []byte, qualifier []byte, value []byte, tdelete *thrift2.TDelete) (r bool, err error)
	// Parameters:
	//  - Table: the table to increment the value on
	//  - Tincrement: the TIncrement to increment
	Increment(ctx context.Context, table []byte, tincrement *thrift2.TIncrement) (r *thrift2.TResult, err error)
	// Parameters:
	//  - Table: the table to append the value on
	//  - Tappend: the TAppend to append
	Append(ctx context.Context, table []byte, tappend *thrift2.TAppend) (r *thrift2.TResult, err error)
	// Get a Scanner for the provided TScan object.
	//
	// @return Scanner Id to be used with other scanner procedures
	//
	// Parameters:
	//  - Table: the table to get the Scanner for
	//  - Tscan: the scan object to get a Scanner for
	OpenScanner(ctx context.Context, table []byte, tscan *thrift2.TScan) (r int32, err error)
	// Grabs multiple rows from a Scanner.
	//
	// @return Between zero and numRows TResults
	//
	// Parameters:
	//  - ScannerId: the Id of the Scanner to return rows from. This is an Id returned from the openScanner function.
	//  - NumRows: number of rows to return
	GetScannerRows(ctx context.Context, scannerId int32, numRows int32) (r []*thrift2.TResult, err error)
	// Closes the scanner. Should be called to free server side resources timely.
	// Typically close once the scanner is not needed anymore, i.e. after looping
	// over it to get all the required rows.
	//
	// Parameters:
	//  - ScannerId: the Id of the Scanner to close *
	CloseScanner(ctx context.Context, scannerId int32) (err error)
	// mutateRow performs multiple mutations atomically on a single row.
	//
	// Parameters:
	//  - Table: table to apply the mutations
	//  - TrowMutations: mutations to apply
	MutateRow(ctx context.Context, table []byte, trowMutations *thrift2.TRowMutations) (err error)
	// Get results for the provided TScan object.
	// This helper function opens a scanner, get the results and close the scanner.
	//
	// @return between zero and numRows TResults
	//
	// Parameters:
	//  - Table: the table to get the Scanner for
	//  - Tscan: the scan object to get a Scanner for
	//  - NumRows: number of rows to return
	GetScannerResults(ctx context.Context, table []byte, tscan *thrift2.TScan, numRows int32) (r []*thrift2.TResult, err error)
	// Given a table and a row get the location of the region that
	// would contain the given row key.
	//
	// reload = true means the cache will be cleared and the location
	// will be fetched from meta.
	//
	// Parameters:
	//  - Table
	//  - Row
	//  - Reload
	GetRegionLocation(ctx context.Context, table []byte, row []byte, reload bool) (r *thrift2.THRegionLocation, err error)
	// Get all of the region locations for a given table.
	//
	//
	// Parameters:
	//  - Table
	GetAllRegionLocations(ctx context.Context, table []byte) (r []*thrift2.THRegionLocation, err error)
	// Atomically checks if a row/family/qualifier value matches the expected
	// value. If it does, it mutates the row.
	//
	// @return true if the row was mutated, false otherwise
	//
	// Parameters:
	//  - Table: to check in and delete from
	//  - Row: row to check
	//  - Family: column family to check
	//  - Qualifier: column qualifier to check
	//  - CompareOp: comparison to make on the value
	//  - Value: the expected value to be compared against, if not provided the
	// check is for the non-existence of the column in question
	//  - RowMutations: row mutations to execute if the value matches
	CheckAndMutate(ctx context.Context, table []byte, row []byte, family []byte, qualifier []byte, compareOp thrift2.TCompareOp, value []byte, rowMutations *thrift2.TRowMutations) (r bool, err error)
	// Get a table descriptor.
	// @return the TableDescriptor of the giving tablename
	//
	//
	// Parameters:
	//  - Table: the tablename of the table to get tableDescriptor
	GetTableDescriptor(ctx context.Context, table *thrift2.TTableName) (r *thrift2.TTableDescriptor, err error)
	// Get table descriptors of tables.
	// @return the TableDescriptor of the giving tablename
	//
	//
	// Parameters:
	//  - Tables: the tablename list of the tables to get tableDescriptor
	GetTableDescriptors(ctx context.Context, tables []*thrift2.TTableName) (r []*thrift2.TTableDescriptor, err error)
	//
	// @return true if table exists already, false if not
	//
	//
	// Parameters:
	//  - TableName: the tablename of the tables to check
	TableExists(ctx context.Context, tableName *thrift2.TTableName) (r bool, err error)
	// Get table descriptors of tables that match the given pattern
	// @return the tableDescriptors of the matching table
	//
	//
	// Parameters:
	//  - Regex: The regular expression to match against
	//  - IncludeSysTables: set to false if match only against userspace tables
	GetTableDescriptorsByPattern(ctx context.Context, regex string, includeSysTables bool) (r []*thrift2.TTableDescriptor, err error)
	// Get table descriptors of tables in the given namespace
	// @return the tableDescriptors in the namespce
	//
	//
	// Parameters:
	//  - Name: The namesapce's name
	GetTableDescriptorsByNamespace(ctx context.Context, name string) (r []*thrift2.TTableDescriptor, err error)
	// Get table names of tables that match the given pattern
	// @return the table names of the matching table
	//
	//
	// Parameters:
	//  - Regex: The regular expression to match against
	//  - IncludeSysTables: set to false if match only against userspace tables
	GetTableNamesByPattern(ctx context.Context, regex string, includeSysTables bool) (r []*thrift2.TTableName, err error)
	// Get table names of tables in the given namespace
	// @return the table names of the matching table
	//
	//
	// Parameters:
	//  - Name: The namesapce's name
	GetTableNamesByNamespace(ctx context.Context, name string) (r []*thrift2.TTableName, err error)
	// Creates a new table with an initial set of empty regions defined by the specified split keys.
	// The total number of regions created will be the number of split keys plus one. Synchronous
	// operation.
	//
	//
	// Parameters:
	//  - Desc: table descriptor for table
	//  - SplitKeys: rray of split keys for the initial regions of the table
	CreateTable(ctx context.Context, desc *thrift2.TTableDescriptor, splitKeys [][]byte) (err error)
	// Deletes a table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to delete
	DeleteTable(ctx context.Context, tableName *thrift2.TTableName) (err error)
	// Truncate a table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to truncate
	//  - PreserveSplits: whether to  preserve previous splits
	TruncateTable(ctx context.Context, tableName *thrift2.TTableName, preserveSplits bool) (err error)
	// Enalbe a table
	//
	//
	// Parameters:
	//  - TableName: the tablename to enable
	EnableTable(ctx context.Context, tableName *thrift2.TTableName) (err error)
	// Disable a table
	//
	//
	// Parameters:
	//  - TableName: the tablename to disable
	DisableTable(ctx context.Context, tableName *thrift2.TTableName) (err error)
	//
	// @return true if table is enabled, false if not
	//
	//
	// Parameters:
	//  - TableName: the tablename to check
	IsTableEnabled(ctx context.Context, tableName *thrift2.TTableName) (r bool, err error)
	//
	// @return true if table is disabled, false if not
	//
	//
	// Parameters:
	//  - TableName: the tablename to check
	IsTableDisabled(ctx context.Context, tableName *thrift2.TTableName) (r bool, err error)
	//
	// @return true if table is available, false if not
	//
	//
	// Parameters:
	//  - TableName: the tablename to check
	IsTableAvailable(ctx context.Context, tableName *thrift2.TTableName) (r bool, err error)
	//  * Use this api to check if the table has been created with the specified number of splitkeys
	//  * which was used while creating the given table. Note : If this api is used after a table's
	//  * region gets splitted, the api may return false.
	//  *
	//  * @return true if table is available, false if not
	//  *
	//  * @deprecated Since 2.2.0. Because the same method in Table interface has been deprecated
	//  * since 2.0.0, we will remove it in 3.0.0 release.
	//  * Use {@link #isTableAvailable(TTableName tableName)} instead
	// *
	//
	// Parameters:
	//  - TableName: the tablename to check
	//  - SplitKeys: keys to check if the table has been created with all split keys
	IsTableAvailableWithSplit(ctx context.Context, tableName *thrift2.TTableName, splitKeys [][]byte) (r bool, err error)
	// Add a column family to an existing table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to add column family to
	//  - Column: column family descriptor of column family to be added
	AddColumnFamily(ctx context.Context, tableName *thrift2.TTableName, column *thrift2.TColumnFamilyDescriptor) (err error)
	// Delete a column family from a table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to delete column family from
	//  - Column: name of column family to be deleted
	DeleteColumnFamily(ctx context.Context, tableName *thrift2.TTableName, column []byte) (err error)
	// Modify an existing column family on a table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to modify column family
	//  - Column: column family descriptor of column family to be modified
	ModifyColumnFamily(ctx context.Context, tableName *thrift2.TTableName, column *thrift2.TColumnFamilyDescriptor) (err error)
	// Modify an existing table
	//
	//
	// Parameters:
	//  - Desc: the descriptor of the table to modify
	ModifyTable(ctx context.Context, desc *thrift2.TTableDescriptor) (err error)
	// Create a new namespace. Blocks until namespace has been successfully created or an exception is
	// thrown
	//
	//
	// Parameters:
	//  - NamespaceDesc: descriptor which describes the new namespace
	CreateNamespace(ctx context.Context, namespaceDesc *thrift2.TNamespaceDescriptor) (err error)
	// Modify an existing namespace.  Blocks until namespace has been successfully modified or an
	// exception is thrown
	//
	//
	// Parameters:
	//  - NamespaceDesc: descriptor which describes the new namespace
	ModifyNamespace(ctx context.Context, namespaceDesc *thrift2.TNamespaceDescriptor) (err error)
	// Delete an existing namespace. Only empty namespaces (no tables) can be removed.
	// Blocks until namespace has been successfully deleted or an
	// exception is thrown.
	//
	//
	// Parameters:
	//  - Name: namespace name
	DeleteNamespace(ctx context.Context, name string) (err error)
	// Get a namespace descriptor by name.
	// @retrun the descriptor
	//
	//
	// Parameters:
	//  - Name: name of namespace descriptor
	GetNamespaceDescriptor(ctx context.Context, name string) (r *thrift2.TNamespaceDescriptor, err error)
	// @return all namespaces
	//
	ListNamespaceDescriptors(ctx context.Context) (r []*thrift2.TNamespaceDescriptor, err error)
}

func NewRawClientV2

func NewRawClientV2(ctx context.Context, option RawClientOption) (rc Thrift2Client, err error)

type ThriftClient

type ThriftClient interface {
	Open() error
	IsOpen() bool
	Close() error
	// Brings a table on-line (enables it)
	//
	// Parameters:
	//  - TableName: name of the table
	EnableTable(tableName thrift1.Bytes) (err error)
	// Disables a table (takes it off-line) If it is being served, the master
	// will tell the servers to stop serving it.
	//
	// Parameters:
	//  - TableName: name of the table
	DisableTable(tableName thrift1.Bytes) (err error)
	// @return true if table is on-line
	//
	// Parameters:
	//  - TableName: name of the table to check
	IsTableEnabled(tableName thrift1.Bytes) (r bool, err error)
	// Parameters:
	//  - TableNameOrRegionName
	Compact(tableNameOrRegionName thrift1.Bytes) (err error)
	// Parameters:
	//  - TableNameOrRegionName
	MajorCompact(tableNameOrRegionName thrift1.Bytes) (err error)
	// List all the userspace tables.
	//
	// @return returns a list of names
	GetTableNames() (r [][]byte, err error)
	// List all the column families assoicated with a table.
	//
	// @return list of column family descriptors
	//
	// Parameters:
	//  - TableName: table name
	GetColumnDescriptors(tableName thrift1.Text) (r map[string]*thrift1.ColumnDescriptor, err error)
	// List the regions associated with a table.
	//
	// @return list of region descriptors
	//
	// Parameters:
	//  - TableName: table name
	GetTableRegions(tableName thrift1.Text) (r []*thrift1.TRegionInfo, err error)
	// Create a table with the specified column families.  The name
	// field for each ColumnDescriptor must be set and must end in a
	// colon (:). All other fields are optional and will get default
	// values if not explicitly specified.
	//
	// @throws IllegalArgument if an input parameter is invalid
	//
	// @throws AlreadyExists if the table name already exists
	//
	// Parameters:
	//  - TableName: name of table to create
	//  - ColumnFamilies: list of column family descriptors
	CreateTable(tableName thrift1.Text, columnFamilies []*thrift1.ColumnDescriptor) (err error)
	// Deletes a table
	//
	// @throws IOError if table doesn't exist on server or there was some other
	// problem
	//
	// Parameters:
	//  - TableName: name of table to delete
	DeleteTable(tableName thrift1.Text) (err error)
	// Get a single TCell for the specified table, row, and column at the
	// latest timestamp. Returns an empty list if no such value exists.
	//
	// @return value for specified row/column
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row key
	//  - Column: column name
	//  - Attributes: Get attributes
	Get(tableName thrift1.Text, row thrift1.Text, column thrift1.Text, attributes map[string]thrift1.Text) (r []*thrift1.TCell, err error)
	// Get the specified number of versions for the specified table,
	// row, and column.
	//
	// @return list of cells for specified row/column
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row key
	//  - Column: column name
	//  - NumVersions: number of versions to retrieve
	//  - Attributes: Get attributes
	GetVer(tableName thrift1.Text, row thrift1.Text, column thrift1.Text, numVersions int32, attributes map[string]thrift1.Text) (r []*thrift1.TCell, err error)
	// Get the specified number of versions for the specified table,
	// row, and column.  Only versions less than or equal to the specified
	// timestamp will be returned.
	//
	// @return list of cells for specified row/column
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row key
	//  - Column: column name
	//  - Timestamp: timestamp
	//  - NumVersions: number of versions to retrieve
	//  - Attributes: Get attributes
	GetVerTs(tableName thrift1.Text, row thrift1.Text, column thrift1.Text, timestamp int64, numVersions int32, attributes map[string]thrift1.Text) (r []*thrift1.TCell, err error)
	// Get all the data for the specified table and row at the latest
	// timestamp. Returns an empty list if the row does not exist.
	//
	// @return TRowResult containing the row and map of columns to TCells
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row key
	//  - Attributes: Get attributes
	GetRow(tableName thrift1.Text, row thrift1.Text, attributes map[string]thrift1.Text) (r []*thrift1.TRowResult_, err error)
	// Get the specified columns for the specified table and row at the latest
	// timestamp. Returns an empty list if the row does not exist.
	//
	// @return TRowResult containing the row and map of columns to TCells
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row key
	//  - Columns: List of columns to return, null for all columns
	//  - Attributes: Get attributes
	GetRowWithColumns(tableName thrift1.Text, row thrift1.Text, columns [][]byte, attributes map[string]thrift1.Text) (r []*thrift1.TRowResult_, err error)
	// Get all the data for the specified table and row at the specified
	// timestamp. Returns an empty list if the row does not exist.
	//
	// @return TRowResult containing the row and map of columns to TCells
	//
	// Parameters:
	//  - TableName: name of the table
	//  - Row: row key
	//  - Timestamp: timestamp
	//  - Attributes: Get attributes
	GetRowTs(tableName thrift1.Text, row thrift1.Text, timestamp int64, attributes map[string]thrift1.Text) (r []*thrift1.TRowResult_, err error)
	// Get the specified columns for the specified table and row at the specified
	// timestamp. Returns an empty list if the row does not exist.
	//
	// @return TRowResult containing the row and map of columns to TCells
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row key
	//  - Columns: List of columns to return, null for all columns
	//  - Timestamp
	//  - Attributes: Get attributes
	GetRowWithColumnsTs(tableName thrift1.Text, row thrift1.Text, columns [][]byte, timestamp int64, attributes map[string]thrift1.Text) (r []*thrift1.TRowResult_, err error)
	// Get all the data for the specified table and rows at the latest
	// timestamp. Returns an empty list if no rows exist.
	//
	// @return TRowResult containing the rows and map of columns to TCells
	//
	// Parameters:
	//  - TableName: name of table
	//  - Rows: row keys
	//  - Attributes: Get attributes
	GetRows(tableName thrift1.Text, rows [][]byte, attributes map[string]thrift1.Text) (r []*thrift1.TRowResult_, err error)
	// Get the specified columns for the specified table and rows at the latest
	// timestamp. Returns an empty list if no rows exist.
	//
	// @return TRowResult containing the rows and map of columns to TCells
	//
	// Parameters:
	//  - TableName: name of table
	//  - Rows: row keys
	//  - Columns: List of columns to return, null for all columns
	//  - Attributes: Get attributes
	GetRowsWithColumns(tableName thrift1.Text, rows [][]byte, columns [][]byte, attributes map[string]thrift1.Text) (r []*thrift1.TRowResult_, err error)
	// Get all the data for the specified table and rows at the specified
	// timestamp. Returns an empty list if no rows exist.
	//
	// @return TRowResult containing the rows and map of columns to TCells
	//
	// Parameters:
	//  - TableName: name of the table
	//  - Rows: row keys
	//  - Timestamp: timestamp
	//  - Attributes: Get attributes
	GetRowsTs(tableName thrift1.Text, rows [][]byte, timestamp int64, attributes map[string]thrift1.Text) (r []*thrift1.TRowResult_, err error)
	// Get the specified columns for the specified table and rows at the specified
	// timestamp. Returns an empty list if no rows exist.
	//
	// @return TRowResult containing the rows and map of columns to TCells
	//
	// Parameters:
	//  - TableName: name of table
	//  - Rows: row keys
	//  - Columns: List of columns to return, null for all columns
	//  - Timestamp
	//  - Attributes: Get attributes
	GetRowsWithColumnsTs(tableName thrift1.Text, rows [][]byte, columns [][]byte, timestamp int64, attributes map[string]thrift1.Text) (r []*thrift1.TRowResult_, err error)
	// Apply a series of mutations (updates/deletes) to a row in a
	// single transaction.  If an exception is thrown, then the
	// transaction is aborted.  Default current timestamp is used, and
	// all entries will have an identical timestamp.
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row key
	//  - Mutations: list of mutation commands
	//  - Attributes: Mutation attributes
	MutateRow(tableName thrift1.Text, row thrift1.Text, mutations []*thrift1.Mutation, attributes map[string]thrift1.Text) (err error)
	// Apply a series of mutations (updates/deletes) to a row in a
	// single transaction.  If an exception is thrown, then the
	// transaction is aborted.  The specified timestamp is used, and
	// all entries will have an identical timestamp.
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row key
	//  - Mutations: list of mutation commands
	//  - Timestamp: timestamp
	//  - Attributes: Mutation attributes
	MutateRowTs(tableName thrift1.Text, row thrift1.Text, mutations []*thrift1.Mutation, timestamp int64, attributes map[string]thrift1.Text) (err error)
	// Apply a series of batches (each a series of mutations on a single row)
	// in a single transaction.  If an exception is thrown, then the
	// transaction is aborted.  Default current timestamp is used, and
	// all entries will have an identical timestamp.
	//
	// Parameters:
	//  - TableName: name of table
	//  - RowBatches: list of row batches
	//  - Attributes: Mutation attributes
	MutateRows(tableName thrift1.Text, rowBatches []*thrift1.BatchMutation, attributes map[string]thrift1.Text) (err error)
	// Apply a series of batches (each a series of mutations on a single row)
	// in a single transaction.  If an exception is thrown, then the
	// transaction is aborted.  The specified timestamp is used, and
	// all entries will have an identical timestamp.
	//
	// Parameters:
	//  - TableName: name of table
	//  - RowBatches: list of row batches
	//  - Timestamp: timestamp
	//  - Attributes: Mutation attributes
	MutateRowsTs(tableName thrift1.Text, rowBatches []*thrift1.BatchMutation, timestamp int64, attributes map[string]thrift1.Text) (err error)
	// Atomically increment the column value specified.  Returns the next value post increment.
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row to increment
	//  - Column: name of column
	//  - Value: amount to increment by
	AtomicIncrement(tableName thrift1.Text, row thrift1.Text, column thrift1.Text, value int64) (r int64, err error)
	// Delete all cells that match the passed row and column.
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: Row to update
	//  - Column: name of column whose value is to be deleted
	//  - Attributes: Delete attributes
	DeleteAll(tableName thrift1.Text, row thrift1.Text, column thrift1.Text, attributes map[string]thrift1.Text) (err error)
	// Delete all cells that match the passed row and column and whose
	// timestamp is equal-to or older than the passed timestamp.
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: Row to update
	//  - Column: name of column whose value is to be deleted
	//  - Timestamp: timestamp
	//  - Attributes: Delete attributes
	DeleteAllTs(tableName thrift1.Text, row thrift1.Text, column thrift1.Text, timestamp int64, attributes map[string]thrift1.Text) (err error)
	// Completely delete the row's cells.
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: key of the row to be completely deleted.
	//  - Attributes: Delete attributes
	DeleteAllRow(tableName thrift1.Text, row thrift1.Text, attributes map[string]thrift1.Text) (err error)
	// Increment a cell by the ammount.
	// Increments can be applied async if hbase.regionserver.thrift.coalesceIncrement is set to true.
	// False is the default.  Turn to true if you need the extra performance and can accept some
	// data loss if a thrift server dies with increments still in the queue.
	//
	// Parameters:
	//  - Increment: The single increment to apply
	Increment(increment *thrift1.TIncrement) (err error)
	// Parameters:
	//  - Increments: The list of increments
	IncrementRows(increments []*thrift1.TIncrement) (err error)
	// Completely delete the row's cells marked with a timestamp
	// equal-to or older than the passed timestamp.
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: key of the row to be completely deleted.
	//  - Timestamp: timestamp
	//  - Attributes: Delete attributes
	DeleteAllRowTs(tableName thrift1.Text, row thrift1.Text, timestamp int64, attributes map[string]thrift1.Text) (err error)
	// Get a scanner on the current table, using the Scan instance
	// for the scan parameters.
	//
	// Parameters:
	//  - TableName: name of table
	//  - Scan: Scan instance
	//  - Attributes: Scan attributes
	ScannerOpenWithScan(tableName thrift1.Text, scan *thrift1.TScan, attributes map[string]thrift1.Text) (r thrift1.ScannerID, err error)
	// Get a scanner on the current table starting at the specified row and
	// ending at the last row in the table.  Return the specified columns.
	//
	// @return scanner id to be used with other scanner procedures
	//
	// Parameters:
	//  - TableName: name of table
	//  - StartRow: Starting row in table to scan.
	// Send "" (empty string) to start at the first row.
	//  - Columns: columns to scan. If column name is a column family, all
	// columns of the specified column family are returned. It's also possible
	// to pass a regex in the column qualifier.
	//  - Attributes: Scan attributes
	ScannerOpen(tableName thrift1.Text, startRow thrift1.Text, columns [][]byte, attributes map[string]thrift1.Text) (r thrift1.ScannerID, err error)
	// Get a scanner on the current table starting and stopping at the
	// specified rows.  ending at the last row in the table.  Return the
	// specified columns.
	//
	// @return scanner id to be used with other scanner procedures
	//
	// Parameters:
	//  - TableName: name of table
	//  - StartRow: Starting row in table to scan.
	// Send "" (empty string) to start at the first row.
	//  - StopRow: row to stop scanning on. This row is *not* included in the
	// scanner's results
	//  - Columns: columns to scan. If column name is a column family, all
	// columns of the specified column family are returned. It's also possible
	// to pass a regex in the column qualifier.
	//  - Attributes: Scan attributes
	ScannerOpenWithStop(tableName thrift1.Text, startRow thrift1.Text, stopRow thrift1.Text, columns [][]byte, attributes map[string]thrift1.Text) (r thrift1.ScannerID, err error)
	// Open a scanner for a given prefix.  That is all rows will have the specified
	// prefix. No other rows will be returned.
	//
	// @return scanner id to use with other scanner calls
	//
	// Parameters:
	//  - TableName: name of table
	//  - StartAndPrefix: the prefix (and thus start row) of the keys you want
	//  - Columns: the columns you want returned
	//  - Attributes: Scan attributes
	ScannerOpenWithPrefix(tableName thrift1.Text, startAndPrefix thrift1.Text, columns [][]byte, attributes map[string]thrift1.Text) (r thrift1.ScannerID, err error)
	// Get a scanner on the current table starting at the specified row and
	// ending at the last row in the table.  Return the specified columns.
	// Only values with the specified timestamp are returned.
	//
	// @return scanner id to be used with other scanner procedures
	//
	// Parameters:
	//  - TableName: name of table
	//  - StartRow: Starting row in table to scan.
	// Send "" (empty string) to start at the first row.
	//  - Columns: columns to scan. If column name is a column family, all
	// columns of the specified column family are returned. It's also possible
	// to pass a regex in the column qualifier.
	//  - Timestamp: timestamp
	//  - Attributes: Scan attributes
	ScannerOpenTs(tableName thrift1.Text, startRow thrift1.Text, columns [][]byte, timestamp int64, attributes map[string]thrift1.Text) (r thrift1.ScannerID, err error)
	// Get a scanner on the current table starting and stopping at the
	// specified rows.  ending at the last row in the table.  Return the
	// specified columns.  Only values with the specified timestamp are
	// returned.
	//
	// @return scanner id to be used with other scanner procedures
	//
	// Parameters:
	//  - TableName: name of table
	//  - StartRow: Starting row in table to scan.
	// Send "" (empty string) to start at the first row.
	//  - StopRow: row to stop scanning on. This row is *not* included in the
	// scanner's results
	//  - Columns: columns to scan. If column name is a column family, all
	// columns of the specified column family are returned. It's also possible
	// to pass a regex in the column qualifier.
	//  - Timestamp: timestamp
	//  - Attributes: Scan attributes
	ScannerOpenWithStopTs(tableName thrift1.Text, startRow thrift1.Text, stopRow thrift1.Text, columns [][]byte, timestamp int64, attributes map[string]thrift1.Text) (r thrift1.ScannerID, err error)
	// Returns the scanner's current row value and advances to the next
	// row in the table.  When there are no more rows in the table, or a key
	// greater-than-or-equal-to the scanner's specified stopRow is reached,
	// an empty list is returned.
	//
	// @return a TRowResult containing the current row and a map of the columns to TCells.
	//
	// @throws IllegalArgument if ScannerID is invalid
	//
	// @throws NotFound when the scanner reaches the end
	//
	// Parameters:
	//  - ID: id of a scanner returned by scannerOpen
	ScannerGet(id thrift1.ScannerID) (r []*thrift1.TRowResult_, err error)
	// Returns, starting at the scanner's current row value nbRows worth of
	// rows and advances to the next row in the table.  When there are no more
	// rows in the table, or a key greater-than-or-equal-to the scanner's
	// specified stopRow is reached,  an empty list is returned.
	//
	// @return a TRowResult containing the current row and a map of the columns to TCells.
	//
	// @throws IllegalArgument if ScannerID is invalid
	//
	// @throws NotFound when the scanner reaches the end
	//
	// Parameters:
	//  - ID: id of a scanner returned by scannerOpen
	//  - NbRows: number of results to return
	ScannerGetList(id thrift1.ScannerID, nbRows int32) (r []*thrift1.TRowResult_, err error)
	// Closes the server-state associated with an open scanner.
	//
	// @throws IllegalArgument if ScannerID is invalid
	//
	// Parameters:
	//  - ID: id of a scanner returned by scannerOpen
	ScannerClose(id thrift1.ScannerID) (err error)
	// Get the regininfo for the specified row. It scans
	// the metatable to find region's start and end keys.
	//
	// @return value for specified row/column
	//
	// Parameters:
	//  - Row: row key
	GetRegionInfo(row thrift1.Text) (r *thrift1.TRegionInfo, err error)
	// Appends values to one or more columns within a single row.
	//
	// @return values of columns after the append operation.
	//
	// Parameters:
	//  - Append: The single append operation to apply
	Append(append *thrift1.TAppend) (r []*thrift1.TCell, err error)
	// Atomically checks if a row/family/qualifier value matches the expected
	// value. If it does, it adds the corresponding mutation operation for put.
	//
	// @return true if the new put was executed, false otherwise
	//
	// Parameters:
	//  - TableName: name of table
	//  - Row: row key
	//  - Column: column name
	//  - Value: the expected value for the column parameter, if not
	// provided the check is for the non-existence of the
	// column in question
	//  - Mput: mutation for the put
	//  - Attributes: Mutation attributes
	CheckAndPut(tableName thrift1.Text, row thrift1.Text, column thrift1.Text, value thrift1.Text, mput *thrift1.Mutation, attributes map[string]thrift1.Text) (r bool, err error)
}

func NewRawClientV1

func NewRawClientV1(ctx context.Context, option RawClientOption) (rc ThriftClient, err error)

type ThriftWithPool

type ThriftWithPool interface {
	// Test for the existence of columns in the table, as specified in the TGet.
	//
	// @return true if the specified TGet matches one or more keys, false if not
	//
	// Parameters:
	//  - Table: the table to check on
	//  - Get: the TGet to check for
	Exists(ctx context.Context, table []byte, get *Get) (r bool, err error)
	// Test for the existence of columns in the table, as specified by the TGets.
	//
	// This will return an array of booleans. Each value will be true if the related Get matches
	// one or more keys, false if not.
	//
	// Parameters:
	//  - Table: the table to check on
	//  - Gets: a list of TGets to check for
	ExistsAll(ctx context.Context, table []byte, gets []*Get) (r []bool, err error)
	// Method for getting data from a row.
	//
	// If the row cannot be found an empty Result is returned.
	// This can be checked by the empty field of the TResult
	//
	// @return the result
	//
	// Parameters:
	//  - Table: the table to get from
	//  - Get: the TGet to fetch
	Get(ctx context.Context, table []byte, get *Get) (r *Result, err error)
	// Method for getting multiple rows.
	//
	// If a row cannot be found there will be a null
	// value in the result list for that TGet at the
	// same position.
	//
	// So the Results are in the same order as the TGets.
	//
	// Parameters:
	//  - Table: the table to get from
	//  - Gets: a list of TGets to fetch, the Result list
	// will have the Results at corresponding positions
	// or null if there was an error
	GetMultiple(ctx context.Context, table []byte, Gets []*Get) (r []*Result, err error)
	// Commit a TPut to a table.
	//
	// Parameters:
	//  - Table: the table to put data in
	//  - Tput: the TPut to put
	Put(ctx context.Context, table []byte, put *Put) (err error)
	// Atomically checks if a row/family/qualifier value matches the expected
	// value. If it does, it adds the TPut.
	//
	// @return true if the new put was executed, false otherwise
	//
	// Parameters:
	//  - Table: to check in and put to
	//  - Row: row to check
	//  - Family: column family to check
	//  - Qualifier: column qualifier to check
	//  - Value: the expected value, if not provided the
	// check is for the non-existence of the
	// column in question
	//  - Tput: the TPut to put if the check succeeds
	CheckAndPut(ctx context.Context, table []byte, row []byte, family []byte, qualifier []byte, value []byte, put *Put) (r bool, err error)
	// Commit a List of Puts to the table.
	//
	// Parameters:
	//  - Table: the table to put data in
	//  - Tputs: a list of TPuts to commit
	PutMultiple(ctx context.Context, table []byte, puts []*Put) (err error)
	// Deletes as specified by the TDelete.
	//
	// Note: "delete" is a reserved keyword and cannot be used in Thrift
	// thus the inconsistent naming scheme from the other functions.
	//
	// Parameters:
	//  - Table: the table to delete from
	//  - Delete: the TDelete to delete
	DeleteSingle(ctx context.Context, table []byte, delete *Delete) (err error)
	// Bulk commit a List of TDeletes to the table.
	//
	// Throws a TIOError if any of the deletes fail.
	//
	// Always returns an empty list for backwards compatibility.
	//
	// Parameters:
	//  - Table: the table to delete from
	//  - Deletes: list of TDeletes to delete
	DeleteMultiple(ctx context.Context, table []byte, deletes []*Delete) (r []*Delete, err error)
	// Atomically checks if a row/family/qualifier value matches the expected
	// value. If it does, it adds the delete.
	//
	// @return true if the new delete was executed, false otherwise
	//
	// Parameters:
	//  - Table: to check in and delete from
	//  - Row: row to check
	//  - Family: column family to check
	//  - Qualifier: column qualifier to check
	//  - Value: the expected value, if not provided the
	// check is for the non-existence of the
	// column in question
	//  - Tdelete: the TDelete to execute if the check succeeds
	CheckAndDelete(ctx context.Context, table []byte, row []byte, family []byte, qualifier []byte, value []byte, delete *Delete) (r bool, err error)
	// Parameters:
	//  - Table: the table to increment the value on
	//  - Increment: the TIncrement to increment
	Increment(ctx context.Context, table []byte, increment *Increment) (r *Result, err error)
	// Parameters:
	//  - Table: the table to append the value on
	//  - Tappend: the TAppend to append
	Append(ctx context.Context, table []byte, append *Append) (r *Result, err error)
	// Get a Scanner for the provided TScan object.
	//
	// @return Scanner Id to be used with other scanner procedures
	//
	// Parameters:
	//  - Table: the table to get the Scanner for
	//  - Tscan: the scan object to get a Scanner for
	OpenScanner(ctx context.Context, table []byte, scan *Scan) (r int32, err error)
	// Grabs multiple rows from a Scanner.
	//
	// @return Between zero and numRows TResults
	//
	// Parameters:
	//  - ScannerId: the Id of the Scanner to return rows from. This is an Id returned from the openScanner function.
	//  - NumRows: number of rows to return
	GetScannerRows(ctx context.Context, scannerId int32, numRows int32) (r []*Result, err error)
	// Closes the scanner. Should be called to free server side resources timely.
	// Typically close once the scanner is not needed anymore, i.e. after looping
	// over it to get all the required rows.
	//
	// Parameters:
	//  - ScannerId: the Id of the Scanner to close *
	CloseScanner(ctx context.Context, scannerId int32) (err error)
	// mutateRow performs multiple mutations atomically on a single row.
	//
	// Parameters:
	//  - Table: table to apply the mutations
	//  - TrowMutations: mutations to apply
	MutateRow(ctx context.Context, table []byte, trowMutations *RowMutations) (err error)
	// Get results for the provided TScan object.
	// This helper function opens a scanner, get the results and close the scanner.
	//
	// @return between zero and numRows TResults
	//
	// Parameters:
	//  - Table: the table to get the Scanner for
	//  - Tscan: the scan object to get a Scanner for
	//  - NumRows: number of rows to return
	GetScannerResults(ctx context.Context, table []byte, tscan *Scan, numRows int32) (r []*Result, err error)
	// Given a table and a row get the location of the region that
	// would contain the given row key.
	//
	// reload = true means the cache will be cleared and the location
	// will be fetched from meta.
	//
	// Parameters:
	//  - Table
	//  - Row
	//  - Reload
	GetRegionLocation(ctx context.Context, table []byte, row []byte, reload bool) (r *HRegionLocation, err error)
	// Get all of the region locations for a given table.
	//
	//
	// Parameters:
	//  - Table
	GetAllRegionLocations(ctx context.Context, table []byte) (r []*HRegionLocation, err error)
	// Atomically checks if a row/family/qualifier value matches the expected
	// value. If it does, it mutates the row.
	//
	// @return true if the row was mutated, false otherwise
	//
	// Parameters:
	//  - Table: to check in and delete from
	//  - Row: row to check
	//  - Family: column family to check
	//  - Qualifier: column qualifier to check
	//  - CompareOp: comparison to make on the value
	//  - Value: the expected value to be compared against, if not provided the
	// check is for the non-existence of the column in question
	//  - RowMutations: row mutations to execute if the value matches
	CheckAndMutate(ctx context.Context, table []byte, row []byte, family []byte, qualifier []byte, compareOp TCompareOp, value []byte, rowMutations *RowMutations) (r bool, err error)
	// Get a table descriptor.
	// @return the TableDescriptor of the giving tablename
	//
	//
	// Parameters:
	//  - Table: the tablename of the table to get tableDescriptor
	GetTableDescriptor(ctx context.Context, table *TableName) (r *TableDescriptor, err error)
	// Get table descriptors of tables.
	// @return the TableDescriptor of the giving tablename
	//
	//
	// Parameters:
	//  - Tables: the tablename list of the tables to get tableDescriptor
	GetTableDescriptors(ctx context.Context, tables []*TableName) (r []*TableDescriptor, err error)
	//
	// @return true if table exists already, false if not
	//
	//
	// Parameters:
	//  - TableName: the tablename of the tables to check
	TableExists(ctx context.Context, tableName *TableName) (r bool, err error)
	// Get table descriptors of tables that match the given pattern
	// @return the tableDescriptors of the matching table
	//
	//
	// Parameters:
	//  - Regex: The regular expression to match against
	//  - IncludeSysTables: set to false if match only against userspace tables
	GetTableDescriptorsByPattern(ctx context.Context, regex string, includeSysTables bool) (r []*TableDescriptor, err error)
	// Get table descriptors of tables in the given namespace
	// @return the tableDescriptors in the namespce
	//
	//
	// Parameters:
	//  - Name: The namesapce's name
	GetTableDescriptorsByNamespace(ctx context.Context, name string) (r []*TableDescriptor, err error)
	// Get table names of tables that match the given pattern
	// @return the table names of the matching table
	//
	//
	// Parameters:
	//  - Regex: The regular expression to match against
	//  - IncludeSysTables: set to false if match only against userspace tables
	GetTableNamesByPattern(ctx context.Context, regex string, includeSysTables bool) (r []*TableName, err error)
	// Get table names of tables in the given namespace
	// @return the table names of the matching table
	//
	//
	// Parameters:
	//  - Name: The namesapce's name
	GetTableNamesByNamespace(ctx context.Context, name string) (r []*TableName, err error)
	// Creates a new table with an initial set of empty regions defined by the specified split keys.
	// The total number of regions created will be the number of split keys plus one. Synchronous
	// operation.
	//
	//
	// Parameters:
	//  - Desc: table descriptor for table
	//  - SplitKeys: rray of split keys for the initial regions of the table
	CreateTable(ctx context.Context, desc *TableDescriptor, splitKeys [][]byte) (err error)
	// Deletes a table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to delete
	DeleteTable(ctx context.Context, tableName *TableName) (err error)
	// Truncate a table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to truncate
	//  - PreserveSplits: whether to  preserve previous splits
	TruncateTable(ctx context.Context, tableName *TableName, preserveSplits bool) (err error)
	// Enalbe a table
	//
	//
	// Parameters:
	//  - TableName: the tablename to enable
	EnableTable(ctx context.Context, tableName *TableName) (err error)
	// Disable a table
	//
	//
	// Parameters:
	//  - TableName: the tablename to disable
	DisableTable(ctx context.Context, tableName *TableName) (err error)
	//
	// @return true if table is enabled, false if not
	//
	//
	// Parameters:
	//  - TableName: the tablename to check
	IsTableEnabled(ctx context.Context, tableName *TableName) (r bool, err error)
	//
	// @return true if table is disabled, false if not
	//
	//
	// Parameters:
	//  - TableName: the tablename to check
	IsTableDisabled(ctx context.Context, tableName *TableName) (r bool, err error)
	//
	// @return true if table is available, false if not
	//
	//
	// Parameters:
	//  - TableName: the tablename to check
	IsTableAvailable(ctx context.Context, tableName *TableName) (r bool, err error)
	//  * Use this api to check if the table has been created with the specified number of splitkeys
	//  * which was used while creating the given table. Note : If this api is used after a table's
	//  * region gets splitted, the api may return false.
	//  *
	//  * @return true if table is available, false if not
	//  *
	//  * @deprecated Since 2.2.0. Because the same method in Table interface has been deprecated
	//  * since 2.0.0, we will remove it in 3.0.0 release.
	//  * Use {@link #isTableAvailable(TTableName tableName)} instead
	// *
	//
	// Parameters:
	//  - TableName: the tablename to check
	//  - SplitKeys: keys to check if the table has been created with all split keys
	IsTableAvailableWithSplit(ctx context.Context, tableName *TableName, splitKeys [][]byte) (r bool, err error)
	// Add a column family to an existing table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to add column family to
	//  - Column: column family descriptor of column family to be added
	AddColumnFamily(ctx context.Context, tableName *TableName, column *ColumnFamilyDescriptor) (err error)
	// Delete a column family from a table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to delete column family from
	//  - Column: name of column family to be deleted
	DeleteColumnFamily(ctx context.Context, tableName *TableName, column []byte) (err error)
	// Modify an existing column family on a table. Synchronous operation.
	//
	//
	// Parameters:
	//  - TableName: the tablename to modify column family
	//  - Column: column family descriptor of column family to be modified
	ModifyColumnFamily(ctx context.Context, tableName *TableName, column *ColumnFamilyDescriptor) (err error)
	// Modify an existing table
	//
	//
	// Parameters:
	//  - Desc: the descriptor of the table to modify
	ModifyTable(ctx context.Context, desc *TableDescriptor) (err error)
	// Create a new namespace. Blocks until namespace has been successfully created or an exception is
	// thrown
	//
	//
	// Parameters:
	//  - NamespaceDesc: descriptor which describes the new namespace
	CreateNamespace(ctx context.Context, namespaceDesc *NamespaceDescriptor) (err error)
	// Modify an existing namespace.  Blocks until namespace has been successfully modified or an
	// exception is thrown
	//
	//
	// Parameters:
	//  - NamespaceDesc: descriptor which describes the new namespace
	ModifyNamespace(ctx context.Context, namespaceDesc *NamespaceDescriptor) (err error)
	// Delete an existing namespace. Only empty namespaces (no tables) can be removed.
	// Blocks until namespace has been successfully deleted or an
	// exception is thrown.
	//
	//
	// Parameters:
	//  - Name: namespace name
	DeleteNamespace(ctx context.Context, name string) (err error)
	// Get a namespace descriptor by name.
	// @retrun the descriptor
	//
	//
	// Parameters:
	//  - Name: name of namespace descriptor
	GetNamespaceDescriptor(ctx context.Context, name string) (r *NamespaceDescriptor, err error)
	// @return all namespaces
	//
	ListNamespaceDescriptors(ctx context.Context) (r []*NamespaceDescriptor, err error)
}

type TimeRange

type TimeRange struct {
	MinStamp int64
	MaxStamp int64
}

Directories

Path Synopsis
example
thrift
v1
v2

Jump to

Keyboard shortcuts

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