hthrift

package
v0.0.0-...-3903214 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LATEST_TIMESTAMP = math.MaxInt64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HBaseHandler

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

func NewHBaseHandler

func NewHBaseHandler(ts *TServer) *HBaseHandler

func (*HBaseHandler) Append

func (h *HBaseHandler) Append(ctx context.Context, append *hbase.TAppend) (r []*hbase.TCell, 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

func (*HBaseHandler) AtomicIncrement

func (h *HBaseHandler) AtomicIncrement(ctx context.Context, tableName hbase.Text, row hbase.Text, column hbase.Text, value int64) (r int64, 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

func (*HBaseHandler) CheckAndPut

func (h *HBaseHandler) CheckAndPut(ctx context.Context, tableName hbase.Text, row hbase.Text, column hbase.Text, value hbase.Text, mput *hbase.Mutation, attributes map[string]hbase.Text) (r bool, 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

func (*HBaseHandler) Compact

func (h *HBaseHandler) Compact(ctx context.Context, tableNameOrRegionName hbase.Bytes) (err error)

Parameters:

  • TableNameOrRegionName

func (*HBaseHandler) CreateTable

func (h *HBaseHandler) CreateTable(ctx context.Context, tableName hbase.Text, columnFamilies []*hbase.ColumnDescriptor) (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

func (*HBaseHandler) DeleteAll

func (h *HBaseHandler) DeleteAll(ctx context.Context, tableName hbase.Text, row hbase.Text, column hbase.Text, attributes map[string]hbase.Text) (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

func (*HBaseHandler) DeleteAllRow

func (h *HBaseHandler) DeleteAllRow(ctx context.Context, tableName hbase.Text, row hbase.Text, attributes map[string]hbase.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

func (*HBaseHandler) DeleteAllRowTs

func (h *HBaseHandler) DeleteAllRowTs(ctx context.Context, tableName hbase.Text, row hbase.Text, timestamp int64, attributes map[string]hbase.Text) (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

func (*HBaseHandler) DeleteAllTs

func (h *HBaseHandler) DeleteAllTs(ctx context.Context, tableName hbase.Text, row hbase.Text, column hbase.Text, timestamp int64, attributes map[string]hbase.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

func (*HBaseHandler) DeleteTable

func (h *HBaseHandler) DeleteTable(ctx context.Context, tableName hbase.Text) (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

func (*HBaseHandler) DisableTable

func (h *HBaseHandler) DisableTable(ctx context.Context, tableName hbase.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

func (*HBaseHandler) EnableTable

func (h *HBaseHandler) EnableTable(ctx context.Context, tableName hbase.Bytes) (err error)

func (*HBaseHandler) Get

func (h *HBaseHandler) Get(ctx context.Context, tableName hbase.Text, row hbase.Text, column hbase.Text, attributes map[string]hbase.Text) (r []*hbase.TCell, 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

func (*HBaseHandler) GetColumnDescriptors

func (h *HBaseHandler) GetColumnDescriptors(ctx context.Context, tableName hbase.Text) (r map[string]*hbase.ColumnDescriptor, err error)

List all the column families assoicated with a table.

@return list of column family descriptors

Parameters:

  • TableName: table name

func (*HBaseHandler) GetRegionInfo

func (h *HBaseHandler) GetRegionInfo(ctx context.Context, row hbase.Text) (r *hbase.TRegionInfo, 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

func (*HBaseHandler) GetRow

func (h *HBaseHandler) GetRow(ctx context.Context, tableName hbase.Text, row hbase.Text, attributes map[string]hbase.Text) (r []*hbase.TRowResult_, 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

func (*HBaseHandler) GetRowOrBefore

func (h *HBaseHandler) GetRowOrBefore(ctx context.Context, tableName hbase.Text, row hbase.Text, family hbase.Text) (r []*hbase.TCell, err error)

Get the row just before the specified one.

@return value for specified row/column

Parameters:

  • TableName: name of table
  • Row: row key
  • Family: column name

func (*HBaseHandler) GetRowTs

func (h *HBaseHandler) GetRowTs(ctx context.Context, tableName hbase.Text, row hbase.Text, timestamp int64, attributes map[string]hbase.Text) (r []*hbase.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

func (*HBaseHandler) GetRowWithColumns

func (h *HBaseHandler) GetRowWithColumns(ctx context.Context, tableName hbase.Text, row hbase.Text, columns []hbase.Text, attributes map[string]hbase.Text) (r []*hbase.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

func (*HBaseHandler) GetRowWithColumnsTs

func (h *HBaseHandler) GetRowWithColumnsTs(ctx context.Context, tableName hbase.Text, row hbase.Text, columns []hbase.Text, timestamp int64, attributes map[string]hbase.Text) (r []*hbase.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

func (*HBaseHandler) GetRows

func (h *HBaseHandler) GetRows(ctx context.Context, tableName hbase.Text, rows []hbase.Text, attributes map[string]hbase.Text) (r []*hbase.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

func (*HBaseHandler) GetRowsTs

func (h *HBaseHandler) GetRowsTs(ctx context.Context, tableName hbase.Text, rows []hbase.Text, timestamp int64, attributes map[string]hbase.Text) (r []*hbase.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

func (*HBaseHandler) GetRowsWithColumns

func (h *HBaseHandler) GetRowsWithColumns(ctx context.Context, tableName hbase.Text, rows []hbase.Text, columns []hbase.Text, attributes map[string]hbase.Text) (r []*hbase.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

func (*HBaseHandler) GetRowsWithColumnsTs

func (h *HBaseHandler) GetRowsWithColumnsTs(ctx context.Context, tableName hbase.Text, rows []hbase.Text, columns []hbase.Text, timestamp int64, attributes map[string]hbase.Text) (r []*hbase.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

func (*HBaseHandler) GetTableNames

func (h *HBaseHandler) GetTableNames(ctx context.Context) (r []hbase.Text, err error)

List all the userspace tables.

@return returns a list of names

func (*HBaseHandler) GetTableRegions

func (h *HBaseHandler) GetTableRegions(ctx context.Context, tableName hbase.Text) (r []*hbase.TRegionInfo, err error)

List the regions associated with a table.

@return list of region descriptors

Parameters:

  • TableName: table name

func (*HBaseHandler) GetVer

func (h *HBaseHandler) GetVer(ctx context.Context, tableName hbase.Text, row hbase.Text, column hbase.Text, numVersions int32, attributes map[string]hbase.Text) (r []*hbase.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

func (*HBaseHandler) GetVerTs

func (h *HBaseHandler) GetVerTs(ctx context.Context, tableName hbase.Text, row hbase.Text, column hbase.Text, timestamp int64, numVersions int32, attributes map[string]hbase.Text) (r []*hbase.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

func (*HBaseHandler) Increment

func (h *HBaseHandler) Increment(ctx context.Context, increment *hbase.TIncrement) (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

func (*HBaseHandler) IncrementRows

func (h *HBaseHandler) IncrementRows(ctx context.Context, increments []*hbase.TIncrement) (err error)

Parameters:

  • Increments: The list of increments

func (*HBaseHandler) IsTableEnabled

func (h *HBaseHandler) IsTableEnabled(ctx context.Context, tableName hbase.Bytes) (r bool, err error)

@return true if table is on-line

Parameters:

  • TableName: name of the table to check

func (*HBaseHandler) MajorCompact

func (h *HBaseHandler) MajorCompact(ctx context.Context, tableNameOrRegionName hbase.Bytes) (err error)

Parameters:

  • TableNameOrRegionName

func (*HBaseHandler) MutateRow

func (h *HBaseHandler) MutateRow(ctx context.Context, tableName hbase.Text, row hbase.Text, mutations []*hbase.Mutation, attributes map[string]hbase.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. 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

func (*HBaseHandler) MutateRowTs

func (h *HBaseHandler) MutateRowTs(ctx context.Context, tableName hbase.Text, row hbase.Text, mutations []*hbase.Mutation, timestamp int64, attributes map[string]hbase.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

func (*HBaseHandler) MutateRows

func (h *HBaseHandler) MutateRows(ctx context.Context, tableName hbase.Text, rowBatches []*hbase.BatchMutation, attributes map[string]hbase.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 thel 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

func (*HBaseHandler) MutateRowsTs

func (h *HBaseHandler) MutateRowsTs(ctx context.Context, tableName hbase.Text, rowBatches []*hbase.BatchMutation, timestamp int64, attributes map[string]hbase.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

func (*HBaseHandler) ScannerClose

func (h *HBaseHandler) ScannerClose(ctx context.Context, id hbase.ScannerID) (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

func (*HBaseHandler) ScannerGet

func (h *HBaseHandler) ScannerGet(ctx context.Context, id hbase.ScannerID) (r []*hbase.TRowResult_, 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

func (*HBaseHandler) ScannerGetList

func (h *HBaseHandler) ScannerGetList(ctx context.Context, id hbase.ScannerID, nbRows int32) (r []*hbase.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

func (*HBaseHandler) ScannerOpen

func (h *HBaseHandler) ScannerOpen(ctx context.Context, tableName hbase.Text, startRow hbase.Text, columns []hbase.Text, attributes map[string]hbase.Text) (r hbase.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

func (*HBaseHandler) ScannerOpenTs

func (h *HBaseHandler) ScannerOpenTs(ctx context.Context, tableName hbase.Text, startRow hbase.Text, columns []hbase.Text, timestamp int64, attributes map[string]hbase.Text) (r hbase.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

func (*HBaseHandler) ScannerOpenWithPrefix

func (h *HBaseHandler) ScannerOpenWithPrefix(ctx context.Context, tableName hbase.Text, startAndPrefix hbase.Text, columns []hbase.Text, attributes map[string]hbase.Text) (r hbase.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

func (*HBaseHandler) ScannerOpenWithScan

func (h *HBaseHandler) ScannerOpenWithScan(ctx context.Context, tableName hbase.Text, scan *hbase.TScan, attributes map[string]hbase.Text) (r hbase.ScannerID, 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

func (*HBaseHandler) ScannerOpenWithStop

func (h *HBaseHandler) ScannerOpenWithStop(ctx context.Context, tableName hbase.Text, startRow hbase.Text, stopRow hbase.Text, columns []hbase.Text, attributes map[string]hbase.Text) (r hbase.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

func (*HBaseHandler) ScannerOpenWithStopTs

func (h *HBaseHandler) ScannerOpenWithStopTs(ctx context.Context, tableName hbase.Text, startRow hbase.Text, stopRow hbase.Text, columns []hbase.Text, timestamp int64, attributes map[string]hbase.Text) (r hbase.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

type TScanner

type TScanner struct {
	ResultIter session.RecordSet
	// contains filtered or unexported fields
}

type TServer

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

func NewTServer

func NewTServer(cfg *config.Config, factory pools.Factory) (*TServer, error)

func (*TServer) Close

func (ts *TServer) Close()

func (*TServer) Run

func (ts *TServer) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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