public class TableStorageAdaptor extends Object
| Constructor and Description |
|---|
TableStorageAdaptor(String endpoint,
String instanceName,
String accessKeyId,
String secretAccessKey)
Construct a TableStorage Adaptor to connect with TableStorage.
|
| Modifier and Type | Method and Description |
|---|---|
Object[] |
batch(String tableName,
List<? extends org.apache.hadoop.hbase.client.Row> actions)
Perform Row operations in batch.
|
void |
batchDeleteRow(String tableName,
List<org.apache.hadoop.hbase.client.Delete> deletes)
Batch delete rows in the table
|
org.apache.hadoop.hbase.client.Result[] |
batchGetRow(String tableName,
List<org.apache.hadoop.hbase.client.Get> gets)
Batch get rows in the table.
|
void |
batchPutRow(String tableName,
List<org.apache.hadoop.hbase.client.Put> puts)
Batch put rows to the table.
|
void |
close()
Close the connection with TableStorage.
|
void |
createTable(String tableName,
CompressType compressType,
int maxVersions,
int ttl)
Create table in TableStorage.
|
void |
deleteRow(String tableName,
org.apache.hadoop.hbase.client.Delete delete)
Delete a row in the table.
|
void |
dropTable(String tableName)
Drop table in TableStorage
|
byte[][] |
getEndKeys(String tableName)
Get the maximum key for every region in the table.
|
org.apache.hadoop.hbase.client.Result |
getRow(String tableName,
org.apache.hadoop.hbase.client.Get get)
Get a row in the table.
|
org.apache.hadoop.hbase.util.Pair<byte[][],byte[][]> |
getStartEndKeys(String tableName)
Get the minimum key and the maximum key for every region in the table.
|
byte[][] |
getStartKeys(String tableName)
Get the minimum key for every region in the table.
|
org.apache.hadoop.hbase.HTableDescriptor |
getTable(String tableName)
Get the Table Descriptor from TableStorage.
|
boolean |
isTableAvailable(String tableName)
Check if the table is available
|
List<String> |
listTable()
List tables from TableStorage.
|
void |
putRow(String tableName,
org.apache.hadoop.hbase.client.Put put)
Put a row to the table.
|
List<org.apache.hadoop.hbase.client.Result> |
scan(String tableName,
org.apache.hadoop.hbase.client.Scan scan,
String startRowkey,
ByteArrayOutputStream nextStartRowkeyStream)
Scan data in the table.
|
void |
updateTable(String tableName,
CompressType compressType,
int maxVersions,
int ttl)
Update table in TableStorage.
|
public TableStorageAdaptor(String endpoint, String instanceName, String accessKeyId, String secretAccessKey)
endpoint - TableStorage endpoint e.g. bts.bd.baidubce.com.instanceName - The target instance name.accessKeyId - User's accessKeyId.secretAccessKey - User's secretAccessKey.public org.apache.hadoop.hbase.HTableDescriptor getTable(String tableName) throws IOException
tableName - The name of the table.IOException - If a permission error or remote error occurspublic List<String> listTable() throws IOException
IOException - If a permission error or remote error occurspublic void createTable(String tableName, CompressType compressType, int maxVersions, int ttl) throws IOException
tableName - The name of the table.compressType - The compression type of the table.maxVersions - The max versions of the table.ttl - TimeToLive of the table, in seconds.IOException - If a permission error or remote error occurspublic void dropTable(String tableName) throws IOException
tableName - The name of the table.IOException - If a permission error or remote error occurspublic boolean isTableAvailable(String tableName) throws IOException
tableName - The name of the table.IOException - If a permission error or remote error occurs.public void updateTable(String tableName, CompressType compressType, int maxVersions, int ttl) throws IOException
tableName - The name of the table.compressType - The compression type of the table.maxVersions - The max versions of the table.ttl - TimeToLive of the table, in seconds.IOException - If a permission error or remote error occurs.public Object[] batch(String tableName, List<? extends org.apache.hadoop.hbase.client.Row> actions) throws IOException
tableName - The name of the table.actions - List of Row operation. Only support Get, Put and Delete.IOException - If a permission error or remote error occurs.public org.apache.hadoop.hbase.client.Result getRow(String tableName, org.apache.hadoop.hbase.client.Get get) throws IOException
tableName - The name of the target table.get - Used to specify the target data in the table.IOException - If a permission error or remote error occurs.public org.apache.hadoop.hbase.client.Result[] batchGetRow(String tableName, List<org.apache.hadoop.hbase.client.Get> gets) throws IOException
tableName - The name of the target table.gets - List of Gets.IOException - If a permission error or remote error occurs.public void putRow(String tableName, org.apache.hadoop.hbase.client.Put put) throws IOException
tableName - The name of the target table.put - Used to describe a single row.IOException - If a permission error or remote error occurs.public void batchPutRow(String tableName, List<org.apache.hadoop.hbase.client.Put> puts) throws IOException
tableName - The name of the target table.puts - List of Puts.IOException - If a permission error or remote error occurs.public void deleteRow(String tableName, org.apache.hadoop.hbase.client.Delete delete) throws IOException
tableName - The name of the target table.delete - Used to specify the target data in the table.IOException - If a permission error or remote error occurs.public void batchDeleteRow(String tableName, List<org.apache.hadoop.hbase.client.Delete> deletes) throws IOException
tableName - The name of the target table.deletes - List of Deletes.IOException - If a permission error or remote error occurs.public List<org.apache.hadoop.hbase.client.Result> scan(String tableName, org.apache.hadoop.hbase.client.Scan scan, String startRowkey, ByteArrayOutputStream nextStartRowkeyStream) throws IOException
tableName - The name of the target table.scan - Used to specify the target data in the table.startRowkey - This scan will start with the maximum of
scan.getStartRow() and startRowkey.nextStartRowkeyStream - Next scan should start with it.IOException - If a permission error or remote error occurs.public byte[][] getStartKeys(String tableName) throws IOException
tableName - The name of the target table.IOException - If a permission error or remote error occurs.public byte[][] getEndKeys(String tableName) throws IOException
tableName - The name of the target table.IOException - If a permission error or remote error occurs.public org.apache.hadoop.hbase.util.Pair<byte[][],byte[][]> getStartEndKeys(String tableName) throws IOException
tableName - The name of the target table.IOException - If a permission error or remote error occurs.public void close()
Copyright © 2022. All rights reserved.