public class AsyncClient extends Object implements AsyncClientInterface
| Constructor and Description |
|---|
AsyncClient(String endpoint,
CredentialsProvider credsProvider,
String instanceName,
ClientConfiguration config,
ResourceManager resourceManager) |
AsyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName)
使用指定的TableStore Endpoint和默认配置构造一个新的
AsyncClient实例。 |
AsyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName,
ClientConfiguration config)
使用指定的TableStore Endpoint和默认配置构造一个新的
AsyncClient实例。 |
AsyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName,
ClientConfiguration config,
ExecutorService callbackExecutor)
使用指定的TableStore Endpoint和默认配置构造一个新的
AsyncClient实例。 |
AsyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName,
ClientConfiguration config,
ExecutorService callbackExecutor,
String stsToken)
使用指定的TableStore Endpoint和默认配置构造一个新的
AsyncClient实例。 |
AsyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName,
ClientConfiguration config,
String stsToken)
使用指定的TableStore Endpoint和默认配置构造一个新的
AsyncClient实例。 |
AsyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName,
String stsToken)
使用指定的TableStore Endpoint和默认配置构造一个新的
AsyncClient实例。 |
public AsyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName)
AsyncClient实例。endpoint - TableStore服务的endpoint。accessKeyId - 访问TableStore服务的Access ID。accessKeySecret - 访问TableStore服务的Access Key。instanceName - 访问TableStore服务的实例名称。public AsyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, String stsToken)
AsyncClient实例。endpoint - TableStore服务的endpoint。accessKeyId - 访问TableStore服务的Access ID。accessKeySecret - 访问TableStore服务的Access Key。instanceName - 访问TableStore服务的实例名称。stsToken - Sts Token.public AsyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, ClientConfiguration config)
AsyncClient实例。endpoint - TableStore服务的endpoint。accessKeyId - 访问TableStore服务的Access ID。accessKeySecret - 访问TableStore服务的Access Key。instanceName - 访问TableStore服务的实例名称。config - 客户端配置信息(ClientConfiguration)。 如果传入null则使用默认配置。public AsyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, ClientConfiguration config, String stsToken)
AsyncClient实例。endpoint - TableStore服务的endpoint。accessKeyId - 访问TableStore服务的Access ID。accessKeySecret - 访问TableStore服务的Access Key。instanceName - 访问TableStore服务的实例名称。config - 客户端配置信息(ClientConfiguration)。 如果传入null则使用默认配置。stsToken - Sts Token.public AsyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, ClientConfiguration config, ExecutorService callbackExecutor)
AsyncClient实例。endpoint - TableStore服务的endpoint。accessKeyId - 访问TableStore服务的Access ID。accessKeySecret - 访问TableStore服务的Access Key。instanceName - 访问TableStore服务的实例名称。config - 客户端配置信息(ClientConfiguration)。 如果传入null则使用默认配置。callbackExecutor - 用于执行用户在调用异步接口时传入的Callback。如果传入null则使用默认配置(
线程数与CPU核数相同的线程池)。public AsyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, ClientConfiguration config, ExecutorService callbackExecutor, String stsToken)
AsyncClient实例。endpoint - TableStore服务的endpoint。accessKeyId - 访问TableStore服务的Access ID。accessKeySecret - 访问TableStore服务的Access Key。instanceName - 访问TableStore服务的实例名称。config - 客户端配置信息(ClientConfiguration)。 如果传入null则使用默认配置。callbackExecutor - 用于执行用户在调用异步接口时传入的Callback。如果传入null则使用默认配置(
线程数与CPU核数相同的线程池)。stsToken - Sts Token.public AsyncClient(String endpoint, CredentialsProvider credsProvider, String instanceName, ClientConfiguration config, ResourceManager resourceManager)
public String getEndpoint()
public String getInstanceName()
public Future<ListTableResponse> listTable(TableStoreCallback<ListTableRequest,ListTableResponse> callback)
AsyncClientInterfacelistTable in interface AsyncClientInterfacecallback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<CreateTableResponse> createTable(CreateTableRequest request, TableStoreCallback<CreateTableRequest,CreateTableResponse> callback)
AsyncClientInterface表被创建后不能立即进行读写操作, 需要等待几秒钟.
createTable in interface AsyncClientInterfacerequest - 执行CreateTable所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<DescribeTableResponse> describeTable(DescribeTableRequest request, TableStoreCallback<DescribeTableRequest,DescribeTableResponse> callback)
AsyncClientInterface获取表的详细信息,表的详细信息包括:
TableMeta)ReservedThroughputDetails)TableOptions)describeTable in interface AsyncClientInterfacerequest - 执行DescribeTable所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<DeleteTableResponse> deleteTable(DeleteTableRequest request, TableStoreCallback<DeleteTableRequest,DeleteTableResponse> callback)
AsyncClientInterface注意:表被成功删除后该表下所有的数据都将会被清空,无法恢复,请谨慎操作!
deleteTable in interface AsyncClientInterfacerequest - 执行DeleteTable所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<UpdateTableResponse> updateTable(UpdateTableRequest request, TableStoreCallback<UpdateTableRequest,UpdateTableResponse> callback)
AsyncClientInterface例如用户想要调整表的TTL、MaxVersions等配置或者用户发现当前预留吞吐量过小需要上调预留吞吐量。
UpdateTable操作不能用于更改表的TableMeta,可以调整的配置为:
ReservedThroughput):
表的预留吞吐量可被动态更改,读或写吞吐量都可以分别单独更改。调整每个表读写吞吐量的最小时间间隔为 1 分钟,
如果本次 UpdateTable 操作距上次 UpdateTable 或者 CreateTable 操作不到 1 分钟的话该请求将被拒绝。
TableOptions):
只有表的部分配置项可以允许被动态更改,例如TTL、MaxVersions等。
updateTable in interface AsyncClientInterfacerequest - 执行UpdateTable所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<CreateIndexResponse> createIndex(CreateIndexRequest request, TableStoreCallback<CreateIndexRequest,CreateIndexResponse> callback)
AsyncClientInterfacecreateIndex in interface AsyncClientInterfacerequest - 执行CreateIndex所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<DeleteIndexResponse> deleteIndex(DeleteIndexRequest request, TableStoreCallback<DeleteIndexRequest,DeleteIndexResponse> callback)
AsyncClientInterfacedeleteIndex in interface AsyncClientInterfacerequest - 执行deleteIndex所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<AddDefinedColumnResponse> addDefinedColumn(AddDefinedColumnRequest request, TableStoreCallback<AddDefinedColumnRequest,AddDefinedColumnResponse> callback)
AsyncClientInterfaceaddDefinedColumn in interface AsyncClientInterfacerequest - 执行addDefinedColumn所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<DeleteDefinedColumnResponse> deleteDefinedColumn(DeleteDefinedColumnRequest request, TableStoreCallback<DeleteDefinedColumnRequest,DeleteDefinedColumnResponse> callback)
AsyncClientInterfacedeleteDefinedColumn in interface AsyncClientInterfacerequest - 执行deleteDefinedColumn所需的参数callback - 请求完成后调用的回调函数,可以为nukk,则代表不需要执行回调函数public Future<GetRowResponse> getRow(GetRowRequest request, TableStoreCallback<GetRowRequest,GetRowResponse> callback)
AsyncClientInterfacegetRow in interface AsyncClientInterfacerequest - 执行GetRow操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<PutRowResponse> putRow(PutRowRequest request, TableStoreCallback<PutRowRequest,PutRowResponse> callback)
AsyncClientInterface若要写入的行已经存在,则旧行会被删除后写入新的一行。
若要写入的行不存在,则直接写入新的一行。
putRow in interface AsyncClientInterfacerequest - 执行PutRow操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<UpdateRowResponse> updateRow(UpdateRowRequest request, TableStoreCallback<UpdateRowRequest,UpdateRowResponse> callback)
AsyncClientInterface若要更新的行不存在,则新写入一行数据。
更新操作可以包括新写入一个属性列或者删除一个属性列的一个或多个版本。
updateRow in interface AsyncClientInterfacerequest - 执行UpdateRow操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<DeleteRowResponse> deleteRow(DeleteRowRequest request, TableStoreCallback<DeleteRowRequest,DeleteRowResponse> callback)
AsyncClientInterface若该行存在,则删除该行。
若该行不存在,则该操作不产生任何影响。
deleteRow in interface AsyncClientInterfacerequest - 执行DeleteRow操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<BatchGetRowResponse> batchGetRow(BatchGetRowRequest request, TableStoreCallback<BatchGetRowRequest,BatchGetRowResponse> callback)
AsyncClientInterfaceBatchGetRow 操作可视为多个 GetRow 操作的集合,各个操作独立执行,独立返回结果,独立计算服务能力单元。
与执行大量的 GetRow 操作相比,使用 BatchGetRow 操作可以有效减少请求的响应时间,提高数据的读取速率。
但需要注意的是 BatchGetRow 只支持在表级别设置查询条件。操作完成后,需要逐个检查子请求的状态,并选择对失败的行进行重试。
batchGetRow in interface AsyncClientInterfacerequest - 执行BatchGetRow操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<BatchWriteRowResponse> batchWriteRow(BatchWriteRowRequest request, TableStoreCallback<BatchWriteRowRequest,BatchWriteRowResponse> callback)
AsyncClientInterfaceBatchWriteRow 操作可视为多个PutRow、UpdateRow、DeleteRow 操作的集合,各个操作独立执行,独立返回结果,独立计算服务能力单元。
执行 BatchWriteRow 操作后,需要逐个检查子请求的状态,来判断写入结果,并选择对失败的行进行重试。
batchWriteRow in interface AsyncClientInterfacerequest - 执行BatchWriteRow操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<GetRangeResponse> getRange(GetRangeRequest request, TableStoreCallback<GetRangeRequest,GetRangeResponse> callback)
AsyncClientInterfacegetRange in interface AsyncClientInterfacerequest - 执行GetRange操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<BulkExportResponse> bulkExport(BulkExportRequest request, TableStoreCallback<BulkExportRequest,BulkExportResponse> callback)
AsyncClientInterfacebulkExport in interface AsyncClientInterfacerequest - 执行GetRange操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<BulkImportResponse> bulkImport(BulkImportRequest request, TableStoreCallback<BulkImportRequest,BulkImportResponse> callback)
AsyncClientInterfaceBulkImport 操作可视为多个PutRow、UpdateRow、DeleteRow 操作的集合,各个操作独立执行,独立返回结果,独立计算消费单元。
执行 BulkImport 操作后,需要逐个检查子请求的状态,来判断写入结果,并选择对失败的行进行重试。
bulkImport in interface AsyncClientInterfacerequest - 执行BatchWriteRow操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<ComputeSplitsBySizeResponse> computeSplitsBySize(ComputeSplitsBySizeRequest request, TableStoreCallback<ComputeSplitsBySizeRequest,ComputeSplitsBySizeResponse> callback)
AsyncClientInterfacecomputeSplitsBySize in interface AsyncClientInterfacerequest - 执行ComputeSplitsBySize操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<ListStreamResponse> listStream(ListStreamRequest request, TableStoreCallback<ListStreamRequest,ListStreamResponse> callback)
AsyncClientInterfacelistStream in interface AsyncClientInterfacerequest - 执行ListStream操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<DescribeStreamResponse> describeStream(DescribeStreamRequest request, TableStoreCallback<DescribeStreamRequest,DescribeStreamResponse> callback)
AsyncClientInterfacedescribeStream in interface AsyncClientInterfacerequest - 执行DescribeStream操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<GetShardIteratorResponse> getShardIterator(GetShardIteratorRequest request, TableStoreCallback<GetShardIteratorRequest,GetShardIteratorResponse> callback)
AsyncClientInterfacegetShardIterator in interface AsyncClientInterfacerequest - 执行GetShardIterator操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<GetStreamRecordResponse> getStreamRecord(GetStreamRecordRequest request, TableStoreCallback<GetStreamRecordRequest,GetStreamRecordResponse> callback)
AsyncClientInterfacegetStreamRecord in interface AsyncClientInterfacerequest - 执行GetStreamRecord操作所需的参数。callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<CreateSearchIndexResponse> createSearchIndex(CreateSearchIndexRequest request, TableStoreCallback<CreateSearchIndexRequest,CreateSearchIndexResponse> callback)
AsyncClientInterfacecreateSearchIndex in interface AsyncClientInterfacerequest - 创建SearchIndex所需的参数,详见CreateSearchIndexRequestcallback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<UpdateSearchIndexResponse> updateSearchIndex(UpdateSearchIndexRequest request, TableStoreCallback<UpdateSearchIndexRequest,UpdateSearchIndexResponse> callback)
AsyncClientInterfaceupdateSearchIndex in interface AsyncClientInterfacerequest - 更新SearchIndex所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<ListSearchIndexResponse> listSearchIndex(ListSearchIndexRequest request, TableStoreCallback<ListSearchIndexRequest,ListSearchIndexResponse> callback)
AsyncClientInterface一个table下面,可以存在多个SearchIndex表,通过该函数,将能够获取一个table下面的所有SearchIndex信息
listSearchIndex in interface AsyncClientInterfacerequest - 获取SearchIndex列表所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<DeleteSearchIndexResponse> deleteSearchIndex(DeleteSearchIndexRequest request, TableStoreCallback<DeleteSearchIndexRequest,DeleteSearchIndexResponse> callback)
AsyncClientInterface通过指定 tableName 和 indexName 即可删除一个index
提示:在没有删除一个table下面所有的index之前,是不允许删除table的
deleteSearchIndex in interface AsyncClientInterfacerequest - 删除SearchIndex所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<DescribeSearchIndexResponse> describeSearchIndex(DescribeSearchIndexRequest request, TableStoreCallback<DescribeSearchIndexRequest,DescribeSearchIndexResponse> callback)
AsyncClientInterfacedescribeSearchIndex in interface AsyncClientInterfacerequest - 获取SearchIndex所需的参数(tableName 和 indexName)callback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数public Future<ComputeSplitsResponse> computeSplits(ComputeSplitsRequest request, TableStoreCallback<ComputeSplitsRequest,ComputeSplitsResponse> callback)
AsyncClientInterfacecomputeSplits in interface AsyncClientInterfacerequest - Parameters required to perform the computeSplits operation.callback - The callback function invoked after the request is completed. It can be null, which means that no callback function is required.public Future<ParallelScanResponse> parallelScan(ParallelScanRequest request, TableStoreCallback<ParallelScanRequest,ParallelScanResponse> callback)
AsyncClientInterfaceparallelScan in interface AsyncClientInterfacerequest - Parameters required to perform the parallelScan operation.callback - The callback function invoked after the request is completed. It can be null, which means that no callback function is required.public Future<SearchResponse> search(SearchRequest request, TableStoreCallback<SearchRequest,SearchResponse> callback)
AsyncClientInterface构建自己的SearchRequest,然后获取SearchResponse
示例:
SearchQuery searchQuery = new SearchQuery();
TermQuery termQuery = new TermQuery();
termQuery.setFieldName("user_name");
termQuery.setTerm("jay");
searchQuery.setQuery(termQuery);
SearchRequest searchRequest = new SearchRequest(tableName, indexName, searchQuery);
SearchResponse resp = ots.search(searchRequest);
search in interface AsyncClientInterfacerequest - 进行搜索所需的参数,详见SearchRequestcallback - 请求完成后调用的回调函数,可以为null,则代表不需要执行回调函数SearchResponsepublic Future<StartLocalTransactionResponse> startLocalTransaction(StartLocalTransactionRequest request, TableStoreCallback<StartLocalTransactionRequest,StartLocalTransactionResponse> callback)
AsyncClientInterfacestartLocalTransaction in interface AsyncClientInterfacerequest - 启动本地事务操作所需的参数public Future<CommitTransactionResponse> commitTransaction(CommitTransactionRequest request, TableStoreCallback<CommitTransactionRequest,CommitTransactionResponse> callback)
AsyncClientInterfacecommitTransaction in interface AsyncClientInterfacerequest - 提交事务操作所需的参数public Future<AbortTransactionResponse> abortTransaction(AbortTransactionRequest request, TableStoreCallback<AbortTransactionRequest,AbortTransactionResponse> callback)
AsyncClientInterfaceabortTransaction in interface AsyncClientInterfacerequest - 取消事务操作所需的参数public Future<CreateDeliveryTaskResponse> createDeliveryTask(CreateDeliveryTaskRequest request, TableStoreCallback<CreateDeliveryTaskRequest,CreateDeliveryTaskResponse> callback)
AsyncClientInterfacecreateDeliveryTask in interface AsyncClientInterfacerequest - 创建投递任务所需的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要回调函数public Future<DeleteDeliveryTaskResponse> deleteDeliveryTask(DeleteDeliveryTaskRequest request, TableStoreCallback<DeleteDeliveryTaskRequest,DeleteDeliveryTaskResponse> callback)
AsyncClientInterfacedeleteDeliveryTask in interface AsyncClientInterfacerequest - 删除投递任务所需要的参数public Future<DescribeDeliveryTaskResponse> describeDeliveryTask(DescribeDeliveryTaskRequest request, TableStoreCallback<DescribeDeliveryTaskRequest,DescribeDeliveryTaskResponse> callback)
AsyncClientInterfacedescribeDeliveryTask in interface AsyncClientInterfacerequest - 描述投递任务所需要的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要回调函数public Future<ListDeliveryTaskResponse> listDeliveryTask(ListDeliveryTaskRequest request, TableStoreCallback<ListDeliveryTaskRequest,ListDeliveryTaskResponse> callback)
AsyncClientInterfacelistDeliveryTask in interface AsyncClientInterfacerequest - 列出投递任务列表所需要的参数callback - 请求完成后调用的回调函数,可以为null,则代表不需要回调函数public SyncClientInterface asSyncClient()
AsyncClientInterfaceasSyncClient in interface AsyncClientInterfacepublic TimeseriesClient asTimeseriesClient()
public AsyncTimeseriesClient asAsyncTimeseriesClient()
public void shutdown()
AsyncClientInterface请确保在所有请求执行完毕之后释放资源。释放资源之后将不能再发送请求,正在执行的请求可能无法返回结果。
shutdown in interface AsyncClientInterfacepublic void switchCredentialsProvider(CredentialsProvider newCrdsProvider)
AsyncClientInterfaceswitchCredentialsProvider in interface AsyncClientInterfacenewCrdsProvider - new CredentialsProvider, see CredentialsProviderFactory.public Future<SQLQueryResponse> sqlQuery(SQLQueryRequest request, TableStoreCallback<SQLQueryRequest,SQLQueryResponse> callback)
sqlQuery in interface AsyncClientInterfaceCopyright © 2024. All Rights Reserved.