public class SyncClient extends Object implements SyncClientInterface
构造器和说明 |
---|
SyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName)
使用指定的TableStore Endpoint和默认配置构造一个新的
SyncClient 实例。 |
SyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName,
ClientConfiguration config)
使用指定的TableStore Endpoint和配置构造一个新的
SyncClient 实例。 |
SyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName,
ClientConfiguration config,
String stsToken)
使用指定的TableStore Endpoint和默认配置构造一个新的
SyncClient 实例。 |
SyncClient(String endpoint,
String accessKeyId,
String accessKeySecret,
String instanceName,
String stsToken)
使用指定的TableStore Endpoint和默认配置构造一个新的
SyncClient 实例。 |
public SyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName)
SyncClient
实例。endpoint
- TableStore服务的endpoint。accessKeyId
- 访问TableStore服务的Access ID。accessKeySecret
- 访问TableStore服务的Access Key。instanceName
- 访问TableStore服务的实例名称。public SyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, String stsToken)
SyncClient
实例。endpoint
- TableStore服务的endpoint。accessKeyId
- 访问TableStore服务的Access ID。accessKeySecret
- 访问TableStore服务的Access Key。instanceName
- 访问TableStore服务的实例名称。stsToken
- Sts Token.public SyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, ClientConfiguration config)
SyncClient
实例。endpoint
- TableStore服务的endpoint。accessKeyId
- 访问TableStore服务的Access ID。accessKeySecret
- 访问TableStore服务的Access Key。instanceName
- 访问TableStore服务的实例名称。config
- 客户端配置信息(ClientConfiguration
)。 如果传入null则使用默认配置。public SyncClient(String endpoint, String accessKeyId, String accessKeySecret, String instanceName, ClientConfiguration config, String stsToken)
SyncClient
实例。endpoint
- TableStore服务的endpoint。accessKeyId
- 访问TableStore服务的Access ID。accessKeySecret
- 访问TableStore服务的Access Key。instanceName
- 访问TableStore服务的实例名称。config
- 客户端配置信息(ClientConfiguration
)。 如果传入null则使用默认配置。stsToken
- Sts Token.public String getEndpoint()
public String getInstanceName()
public CreateTableResponse createTable(CreateTableRequest createTableRequest) throws TableStoreException, ClientException
SyncClientInterface
表被创建后不能立即进行读写操作, 需要等待几秒钟.
createTable
在接口中 SyncClientInterface
createTableRequest
- 执行CreateTable所需的参数TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public ListTableResponse listTable() throws TableStoreException, ClientException
SyncClientInterface
listTable
在接口中 SyncClientInterface
TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public DescribeTableResponse describeTable(DescribeTableRequest request) throws TableStoreException, ClientException
SyncClientInterface
获取表的详细信息,表的详细信息包括:
TableMeta
)ReservedThroughputDetails
)TableOptions
)describeTable
在接口中 SyncClientInterface
request
- 执行DescribeTable所需的参数TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public DeleteTableResponse deleteTable(DeleteTableRequest deleteTableRequest) throws TableStoreException, ClientException
SyncClientInterface
注意:表被成功删除后该表下所有的数据都将会被清空,无法恢复,请谨慎操作!
deleteTable
在接口中 SyncClientInterface
deleteTableRequest
- 执行DeleteTable所需的参数TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public UpdateTableResponse updateTable(UpdateTableRequest request) throws TableStoreException, ClientException
SyncClientInterface
例如用户想要调整表的TTL、MaxVersions等配置或者用户发现当前预留吞吐量过小需要上调预留吞吐量。
UpdateTable操作不能用于更改表的TableMeta,可以调整的配置为:
ReservedThroughput
):
表的预留吞吐量可被动态更改,读或写吞吐量都可以分别单独更改。调整每个表读写吞吐量的最小时间间隔为 1 分钟,
如果本次 UpdateTable 操作距上次 UpdateTable 或者 CreateTable 操作不到 1 分钟的话该请求将被拒绝。
TableOptions
):
只有表的部分配置项可以允许被动态更改,例如TTL、MaxVersions等。
updateTable
在接口中 SyncClientInterface
request
- 执行UpdateTable所需的参数TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public GetRowResponse getRow(GetRowRequest getRowRequest) throws TableStoreException, ClientException
SyncClientInterface
getRow
在接口中 SyncClientInterface
getRowRequest
- 执行GetRow操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public PutRowResponse putRow(PutRowRequest putRowRequest) throws TableStoreException, ClientException
SyncClientInterface
若要写入的行已经存在,则旧行会被删除后写入新的一行。
若要写入的行不存在,则直接写入新的一行。
putRow
在接口中 SyncClientInterface
putRowRequest
- 执行PutRow操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public UpdateRowResponse updateRow(UpdateRowRequest updateRowRequest) throws TableStoreException, ClientException
SyncClientInterface
若要更新的行不存在,则新写入一行数据。
更新操作可以包括新写入一个属性列或者删除一个属性列的一个或多个版本。
updateRow
在接口中 SyncClientInterface
updateRowRequest
- 执行UpdateRow操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public DeleteRowResponse deleteRow(DeleteRowRequest deleteRowRequest) throws TableStoreException, ClientException
SyncClientInterface
若该行存在,则删除该行。
若该行不存在,则该操作不产生任何影响。
deleteRow
在接口中 SyncClientInterface
deleteRowRequest
- 执行DeleteRow操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public BatchGetRowResponse batchGetRow(BatchGetRowRequest batchGetRowRequest) throws TableStoreException, ClientException
SyncClientInterface
BatchGetRow 操作可视为多个 GetRow 操作的集合,各个操作独立执行,独立返回结果,独立计算服务能力单元。
与执行大量的 GetRow 操作相比,使用 BatchGetRow 操作可以有效减少请求的响应时间,提高数据的读取速率。
但需要注意的是 BatchGetRow 只支持在表级别设置查询条件。操作完成后,需要逐个检查子请求的状态,并选择对失败的行进行重试。
batchGetRow
在接口中 SyncClientInterface
batchGetRowRequest
- 执行BatchGetRow操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public BatchWriteRowResponse batchWriteRow(BatchWriteRowRequest batchWriteRowRequest) throws TableStoreException, ClientException
SyncClientInterface
BatchWriteRow 操作可视为多个PutRow、UpdateRow、DeleteRow 操作的集合,各个操作独立执行,独立返回结果,独立计算服务能力单元。
执行 BatchWriteRow 操作后,需要逐个检查子请求的状态,来判断写入结果,并选择对失败的行进行重试。
batchWriteRow
在接口中 SyncClientInterface
batchWriteRowRequest
- 执行BatchWriteRow操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public GetRangeResponse getRange(GetRangeRequest getRangeRequest) throws TableStoreException, ClientException
SyncClientInterface
getRange
在接口中 SyncClientInterface
getRangeRequest
- 执行GetRange操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public ComputeSplitsBySizeResponse computeSplitsBySize(ComputeSplitsBySizeRequest computeSplitsBySizeRequest) throws TableStoreException, ClientException
SyncClientInterface
computeSplitsBySize
在接口中 SyncClientInterface
computeSplitsBySizeRequest
- 执行ComputeSplitsBySize操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public Iterator<Row> createRangeIterator(RangeIteratorParameter rangeIteratorParameter) throws TableStoreException, ClientException
SyncClientInterface
SyncClientInterface.getRange(GetRangeRequest)
接口。createRangeIterator
在接口中 SyncClientInterface
rangeIteratorParameter
- 执行createRangeIterator操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public WideColumnIterator createWideColumnIterator(GetRowRequest getRowRequest) throws TableStoreException, ClientException
public ListStreamResponse listStream(ListStreamRequest listStreamRequest) throws TableStoreException, ClientException
SyncClientInterface
listStream
在接口中 SyncClientInterface
listStreamRequest
- 执行ListStream操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public DescribeStreamResponse describeStream(DescribeStreamRequest describeStreamRequest) throws TableStoreException, ClientException
SyncClientInterface
describeStream
在接口中 SyncClientInterface
describeStreamRequest
- 执行DescribeStream操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public GetShardIteratorResponse getShardIterator(GetShardIteratorRequest getShardIteratorRequest) throws TableStoreException, ClientException
SyncClientInterface
getShardIterator
在接口中 SyncClientInterface
getShardIteratorRequest
- 执行GetShardIterator操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public GetStreamRecordResponse getStreamRecord(GetStreamRecordRequest getStreamRecordRequest) throws TableStoreException, ClientException
SyncClientInterface
getStreamRecord
在接口中 SyncClientInterface
getStreamRecordRequest
- 执行GetStreamRecord操作所需的参数。TableStoreException
- TableStore服务返回的异常ClientException
- 请求的返回结果无效、或遇到网络异常public void shutdown()
SyncClientInterface
请确保在所有请求执行完毕之后释放资源。释放资源之后将不能再发送请求,正在执行的请求可能无法返回结果。
shutdown
在接口中 SyncClientInterface
Copyright © 2017. All Rights Reserved.