@InterfaceAudience.Private public class ThriftHBaseServiceHandler extends Object implements org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
Modifier and Type | Class and Description |
---|---|
private static class |
ThriftHBaseServiceHandler.THBaseServiceMetricsProxy |
Modifier and Type | Field and Description |
---|---|
(package private) static String |
CLEANUP_INTERVAL |
private ConnectionCache |
connectionCache |
private static org.apache.commons.logging.Log |
LOG |
(package private) static String |
MAX_IDLETIME |
private AtomicInteger |
nextScannerId |
private Map<Integer,ResultScanner> |
scannerMap |
Constructor and Description |
---|
ThriftHBaseServiceHandler(org.apache.hadoop.conf.Configuration conf,
UserProvider userProvider) |
Modifier and Type | Method and Description |
---|---|
private int |
addScanner(ResultScanner scanner)
Assigns a unique ID to the scanner and adds the mapping to an internal HashMap.
|
org.apache.hadoop.hbase.thrift2.generated.TResult |
append(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TAppend append) |
boolean |
checkAndDelete(ByteBuffer table,
ByteBuffer row,
ByteBuffer family,
ByteBuffer qualifier,
ByteBuffer value,
org.apache.hadoop.hbase.thrift2.generated.TDelete deleteSingle)
Atomically checks if a row/family/qualifier value matches the expected
value.
|
boolean |
checkAndPut(ByteBuffer table,
ByteBuffer row,
ByteBuffer family,
ByteBuffer qualifier,
ByteBuffer value,
org.apache.hadoop.hbase.thrift2.generated.TPut put)
Atomically checks if a row/family/qualifier value matches the expected
value.
|
void |
closeScanner(int scannerId)
Closes the scanner.
|
private void |
closeTable(Table table) |
List<org.apache.hadoop.hbase.thrift2.generated.TDelete> |
deleteMultiple(ByteBuffer table,
List<org.apache.hadoop.hbase.thrift2.generated.TDelete> deletes)
Bulk commit a List of TDeletes to the table.
|
void |
deleteSingle(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TDelete deleteSingle)
Deletes as specified by the TDelete.
|
boolean |
exists(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TGet get)
Test for the existence of columns in the table, as specified in the TGet.
|
org.apache.hadoop.hbase.thrift2.generated.TResult |
get(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TGet get)
Method for getting data from a row.
|
List<org.apache.hadoop.hbase.thrift2.generated.THRegionLocation> |
getAllRegionLocations(ByteBuffer table)
Get all of the region locations for a given table.
|
private RegionLocator |
getLocator(ByteBuffer tableName) |
List<org.apache.hadoop.hbase.thrift2.generated.TResult> |
getMultiple(ByteBuffer table,
List<org.apache.hadoop.hbase.thrift2.generated.TGet> gets)
Method for getting multiple rows.
|
org.apache.hadoop.hbase.thrift2.generated.THRegionLocation |
getRegionLocation(ByteBuffer table,
ByteBuffer row,
boolean reload)
Given a table and a row get the location of the region that
would contain the given row key.
|
private ResultScanner |
getScanner(int id)
Returns the Scanner associated with the specified Id.
|
List<org.apache.hadoop.hbase.thrift2.generated.TResult> |
getScannerResults(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TScan scan,
int numRows)
Get results for the provided TScan object.
|
List<org.apache.hadoop.hbase.thrift2.generated.TResult> |
getScannerRows(int scannerId,
int numRows)
Grabs multiple rows from a Scanner.
|
private Table |
getTable(ByteBuffer tableName) |
private org.apache.hadoop.hbase.thrift2.generated.TIOError |
getTIOError(IOException e) |
org.apache.hadoop.hbase.thrift2.generated.TResult |
increment(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TIncrement increment) |
void |
mutateRow(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TRowMutations rowMutations)
mutateRow performs multiple mutations atomically on a single row.
|
static org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface |
newInstance(org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface handler,
ThriftMetrics metrics) |
private static long |
now() |
int |
openScanner(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TScan scan)
Get a Scanner for the provided TScan object.
|
void |
put(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TPut put)
Commit a TPut to a table.
|
void |
putMultiple(ByteBuffer table,
List<org.apache.hadoop.hbase.thrift2.generated.TPut> puts)
Commit a List of Puts to the table.
|
protected ResultScanner |
removeScanner(int id)
Removes the scanner associated with the specified ID from the internal HashMap.
|
(package private) void |
setEffectiveUser(String effectiveUser) |
private static final org.apache.commons.logging.Log LOG
private final AtomicInteger nextScannerId
private final Map<Integer,ResultScanner> scannerMap
private final ConnectionCache connectionCache
static final String CLEANUP_INTERVAL
static final String MAX_IDLETIME
ThriftHBaseServiceHandler(org.apache.hadoop.conf.Configuration conf, UserProvider userProvider) throws IOException
IOException
public static org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface newInstance(org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface handler, ThriftMetrics metrics)
private static long now()
private Table getTable(ByteBuffer tableName)
private RegionLocator getLocator(ByteBuffer tableName)
private void closeTable(Table table) throws org.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.hadoop.hbase.thrift2.generated.TIOError
private org.apache.hadoop.hbase.thrift2.generated.TIOError getTIOError(IOException e)
private int addScanner(ResultScanner scanner)
scanner
- to addprivate ResultScanner getScanner(int id)
id
- of the Scanner to getvoid setEffectiveUser(String effectiveUser)
protected ResultScanner removeScanner(int id)
id
- of the Scanner to removenull
if the Id is invalidpublic boolean exists(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TGet get) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
exists
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- the table to check onget
- the TGet to check fororg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public org.apache.hadoop.hbase.thrift2.generated.TResult get(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TGet get) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
get
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- the table to get fromget
- the TGet to fetchorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public List<org.apache.hadoop.hbase.thrift2.generated.TResult> getMultiple(ByteBuffer table, List<org.apache.hadoop.hbase.thrift2.generated.TGet> gets) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
getMultiple
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- the table to get fromgets
- a list of TGets to fetch, the Result list
will have the Results at corresponding positions
or null if there was an errororg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public void put(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TPut put) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
put
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- the table to put data input
- the TPut to putorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value, org.apache.hadoop.hbase.thrift2.generated.TPut put) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
checkAndPut
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- to check in and put torow
- row to checkfamily
- column family to checkqualifier
- column qualifier to checkvalue
- the expected value, if not provided the
check is for the non-existence of the
column in questionput
- the TPut to put if the check succeedsorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public void putMultiple(ByteBuffer table, List<org.apache.hadoop.hbase.thrift2.generated.TPut> puts) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
putMultiple
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- the table to put data inputs
- a list of TPuts to commitorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public void deleteSingle(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TDelete deleteSingle) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
deleteSingle
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- the table to delete fromdeleteSingle
- the TDelete to deleteorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public List<org.apache.hadoop.hbase.thrift2.generated.TDelete> deleteMultiple(ByteBuffer table, List<org.apache.hadoop.hbase.thrift2.generated.TDelete> deletes) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
deleteMultiple
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- the table to delete fromdeletes
- list of TDeletes to deleteorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value, org.apache.hadoop.hbase.thrift2.generated.TDelete deleteSingle) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
checkAndDelete
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- to check in and delete fromrow
- row to checkfamily
- column family to checkqualifier
- column qualifier to checkvalue
- the expected value, if not provided the
check is for the non-existence of the
column in questiondeleteSingle
- the TDelete to execute if the check succeedsorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public org.apache.hadoop.hbase.thrift2.generated.TResult increment(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TIncrement increment) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
increment
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
org.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public org.apache.hadoop.hbase.thrift2.generated.TResult append(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TAppend append) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
append
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
org.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public int openScanner(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TScan scan) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
openScanner
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- the table to get the Scanner forscan
- the scan object to get a Scanner fororg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public List<org.apache.hadoop.hbase.thrift2.generated.TResult> getScannerRows(int scannerId, int numRows) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.hadoop.hbase.thrift2.generated.TIllegalArgument, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
getScannerRows
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
scannerId
- the Id of the Scanner to return rows from. This is an Id returned from the openScanner function.numRows
- number of rows to returnorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.hadoop.hbase.thrift2.generated.TIllegalArgument
org.apache.thrift.TException
public List<org.apache.hadoop.hbase.thrift2.generated.TResult> getScannerResults(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TScan scan, int numRows) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
getScannerResults
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- the table to get the Scanner forscan
- the scan object to get a Scanner fornumRows
- number of rows to returnorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public void closeScanner(int scannerId) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.hadoop.hbase.thrift2.generated.TIllegalArgument, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
closeScanner
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
scannerId
- the Id of the Scanner to close *org.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.hadoop.hbase.thrift2.generated.TIllegalArgument
org.apache.thrift.TException
public void mutateRow(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TRowMutations rowMutations) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
mutateRow
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
table
- table to apply the mutationsrowMutations
- mutations to applyorg.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public List<org.apache.hadoop.hbase.thrift2.generated.THRegionLocation> getAllRegionLocations(ByteBuffer table) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
getAllRegionLocations
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
org.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
public org.apache.hadoop.hbase.thrift2.generated.THRegionLocation getRegionLocation(ByteBuffer table, ByteBuffer row, boolean reload) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
getRegionLocation
in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
org.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.thrift.TException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.